Default values

  • Can anyone explain to me the difference between using DEFAULT CONTRAINT and sp_bindefault to set a default value on a column?

    Which one of the methods is preferred?

    Thanks

    John

  • Basically there is no difference, except that you can define a database wide default with CREATE DEFAULT. This default you can bind via the mentioned s_proc to as many column in as many tables as you like. The DEFAULT constraint is only for one column in one table.

    IIRC, Microsoft states that the DEFAULT constraint is preferred.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • also you must take care that CREATE DEFAULT is usefull if you want to change the default for all columns from 1 place (from 0 to null as an example) ... you will find it in EM under defaults


    Alamir Mohamed
    Alamir_mohamed@yahoo.com

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply