|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
System catalog - defaultsHow can I check for the default value of a column?
I can get to sysobjects where type='D' but I want to find what the value of the default is. TIA - LH forget I asked, information_schema.columns
Show quoteHide quote "lh" <l*@nowhere.com> wrote in message news:5ajZf.322$b6.8082@nasal.pacific.net.au... > How can I check for the default value of a column? > > I can get to sysobjects where type='D' but I want to find what the value > of the default is. > > TIA - LH > lh
CREATE TABLE fff ( col1 INT NOT NULL DEFAULT 5, col2 INT ) GO ALTER TABLE fff ADD CONSTRAINT myConstraint DEFAULT 5 FOR b GO SELECT scobj.name, cols.name FROM sysconstraints sc INNER JOIN sysobjects scobj ON sc.constid = scobj.id AND sc.id=OBJECT_ID('fff') INNER JOIN syscolumns cols ON sc.id = cols.id AND sc.colid = cols.colid GO ---value SELECT text FROM syscomments WHERE id=OBJECT_ID('myConstraint') Show quoteHide quote "lh" <l*@nowhere.com> wrote in message news:5ajZf.322$b6.8082@nasal.pacific.net.au... > How can I check for the default value of a column? > > I can get to sysobjects where type='D' but I want to find what the value > of the default is. > > TIA - LH >
Other interesting topics
Help with a SQL Join statement
Check Constraint More on querying remote server 3 months after the layoff... Passing multiple record sets from one procedure to another can't seem to get my GROUP BY ordering right sequential file and Parent ID's help with case Event Notification question nested queries |
|||||||||||||||||||||||