|
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 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 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 > |
|||||||||||||||||||||||