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 |
|
goblyn27
Starting Member
39 Posts |
Posted - 2002-03-15 : 21:09:06
|
| Im trying to find out how to tell through an SQL query against the syscolumns object what the default value for a column (if any) is and Im not having much luck so I thought I should post the question here.Any help is appreciatedthank you"DuuuDe!! I suck!" |
|
|
joldham
Wiseass Yak Posting Master
300 Posts |
Posted - 2002-03-15 : 22:11:02
|
| This should give you a start. Basically the syscolumns table attaches to the syscomments table, which houses the default values.SELECT c.name Table_Name, a.name Column_Name, b.text Default_ValueFROM dbo.syscolumns a, dbo.syscomments b, dbo.sysobjects cWHERE a.cdefault = b.idand a.id = c.idJeremy |
 |
|
|
|
|
|