• Roland Alexander STL (11/15/2012)


    Hugo Kornelis (11/15/2012)


    Roland Alexander STL (11/15/2012)


    We ought to make note here that DEFAULT has been deprecated in an unspecified future version of SQL Server, so don't get too attached to it 🙂

    I think you are confusing default constraints (which are defined in the ANSI standard, and not deprecated) with "default objects" that can be bound to columns or alias data types.

    The ANSI standard DEFAULT constraint is what's used in this question - no seperate object, but a default definition used as a constraint in the table.

    The deprecated feature uses CREATE DEFAULT to create a default obejct, and then calls the stored procedure sp_binddefault to bind it to either a column or an alias data type.

    Reference (hyperlink!): CREATE DEFAULT

    Re-reading the posts I realize I was not specific in what I said was deprecated. Default constraints are NOT deprecated, quite obviously, but using the DEFAULT keyword in an INSERT statement is deprecated. I apologize for the confusion and thank Hugo for pointing out the inadequacy.

    I wonder if that means that the DEFAULT keyword won't work in updates either. If so I hope they replace the functionality with something else. We use it in some triggers to update a "lastupdate" column. UPDATE tablename SET columname = DEFAULT. I may be missing something but I can't see a way to do this without the DEFAULT keyword.

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]