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 |
|
js.reddy
Yak Posting Veteran
80 Posts |
Posted - 2010-03-12 : 04:23:28
|
| HiI want to get default constraints list.the list should look like in following:TableName Columnname DefaultValueis there any query to get this!!!!! |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-03-12 : 04:47:45
|
| This is the query fot that.SELECT t.Name 'Table Name', c.Name 'Column Name', COLUMN_DEFAULT 'Default Value' FROM sys.objects OINNER JOIN sys.tables t ON o.Parent_Object_ID = t.Object_IDINNER JOIN sys.columns C ON O.Object_ID = C.Default_Object_IDINNER JOIN INFORMATION_SCHEMA.COLUMNS i ON t.Name = i.TABLE_NAME AND c.Name = i.COLUMN_NAMEVabhav T |
 |
|
|
js.reddy
Yak Posting Veteran
80 Posts |
Posted - 2010-03-12 : 05:12:08
|
Thank you so much..quote: Originally posted by vaibhavktiwari83 This is the query fot that.SELECT t.Name 'Table Name', c.Name 'Column Name', COLUMN_DEFAULT 'Default Value' FROM sys.objects OINNER JOIN sys.tables t ON o.Parent_Object_ID = t.Object_IDINNER JOIN sys.columns C ON O.Object_ID = C.Default_Object_IDINNER JOIN INFORMATION_SCHEMA.COLUMNS i ON t.Name = i.TABLE_NAME AND c.Name = i.COLUMN_NAMEVabhav T
|
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-03-12 : 05:30:13
|
| You are welcome...Vabhav T |
 |
|
|
|
|
|