• Duncan Pryde (4/13/2011)


    Henrico Bekker (4/12/2011)


    All 4 options work? one of those questions again...pick 2 out of 4 correct answers...a quessing game again.

    Try this:

    SET DATEFORMAT ydm

    GO

    SELECT CAST('2011-04-28' AS DATETIME)

    or this:

    SET LANGUAGE British

    GO

    SELECT CAST('2011-04-28' AS DATETIME)

    and do the same for the other date types, and you'll see that DATETIME and SMALLDATETIME produce an error while DATE and DATETIME2 don't.

    So no guessing required!

    Duncan

    Just look up the various data types in books online.

    Only DATE and DATETIME2 have Default String literals... the others do not. And the default string literals are YYYY-MM-DD 🙂



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]