which @@datefirst is effective for a default constraint ?

  • this uses the @@datefirst of the connection that inserts a record ...

    constraint DF_dbo_Table_Week default (datepart(week, sysdatetime()))

    wouldn't it be good design (and common sense) to include the datefirst as a parameter to all functions that depend on it ???

    and drop the connection level option?

  • Jizzy Wig (6/25/2012)


    will this use the @@datefirst of the connection that inserts a record?

    constraint DF_dbo_Table_Week default (datepart(week, sysdatetime()))

    Just try yourself:

    SET DATEFIRST 1

    INSERT dbo.Table ...

    SET DATEFIRST 7

    INSERT dbo.Table ...

    and you will see...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

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

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