Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2012-04-23 : 09:31:27
|
| In SSMS, i'm trying to list only the columns in a table that are bit fields. Reason being, there is a checkbox in our front end app that the customer wants "checked" (or set to '1') by default. Our engineers do not have a mapping that shows which sql field is mapped to that checkbox in their Delphi front end, and they are less than cooperative in providing the dba's with the info we need to get our job done, so we're left to use process of elimination go one by one and set the default values in sql to '1' until we see that box "checked" in the app. It would expedite things for me if i could produce a list of the bit fields in the tables that i suspect hold that column. Can this be done?Second question: What's the best way to poison the coffee of an engineer without getting traced back to me? |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2012-04-23 : 09:38:12
|
| select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'tableName' and DATA_TYPE = 'bit'- LumbagoMy blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/ |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-04-23 : 09:39:11
|
[code]SELECT * FROM INFORMATION_SCHEMA.[COLUMNS] WHERE DATA_TYPE = 'bit'[/code]As for your second question, Siri has a brilliant answer, which I leave as an exercise to the reader. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-04-23 : 09:39:54
|
i think your second question is easier than the first.the key is to use the command in redSET TRACE OFFUPDATE CUPSET COFFEE = COFFEE + POISONWHERE OWNER = 'ENGINEER'SET TRACE ON KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2012-04-23 : 09:41:05
|
| select 'alter table ' + TABLE_NAME + ' alter column ' + COLUMN_NAME + ' bit default(1)' from INFORMATION_SCHEMA.COLUMNS where DATA_TYPE = 'bit'- LumbagoMy blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/ |
 |
|
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2012-04-23 : 10:00:03
|
| Ha. Got it. Thanks all. |
 |
|
|
|
|
|