Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defaults Collection

Status
Not open for further replies.

jimmythegeek

Programmer
May 26, 2000
770
US
You can create a default in SQL Server using the following line:

create default rowAdministration as 2

I believe this is retrievable through the defaults collection, but I can't find any examples that show you how to retrieve that value once you have created the default?

Is this possible, if so does anyone know how? Thanks for advance for any input.

Jim Lunde
We all agree your theory is crazy, but is it crazy enough?
 
Explain "defaults collection". Something from ADO or ADOX?

Definition of defaults are stored in table sysobjects (for xtype='D') and syscomments (column text). Column defaults can be also retrieved via information_schema.columns view.

Note there are two "types" of defaults: bindable (created with CREATE DEFAULT) and "inline" (specified for example within CREATE/ALTER TABLE).

------
heisenbug: A bug that disappears or alters its behavior when one attempts to probe or isolate it
schroedinbug: A bug that doesn't appear until someone reads source code and realizes it never should have worked, at which point the program promptly stops working for everybody until fixed.
 
Following on from vongrunt's explanation, it is not recommended to use CREATE DEFAULT any more - it was only included in SQL 7/2000 for backward compatibility. Best practice is to specify defaults in CREATE/ALTER TABLE statements.

--James
 
Thank you for your responses. I was actually trying to use the defaults in a different manner, but based on several factors including your comments, we have now decided to go with plan b.

Jim Lunde
We all agree your theory is crazy, but is it crazy enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top