Why like this????

  • SELECT DATEADD( DD, 1 , YEAR(GETDATE()))

    SELECT DATEADD( DD, 1 , '2016')

    OUTPUT :

    ---------

    1905-07-11 00:00:00.000

    2016-01-02 00:00:00.000

  • SELECT CAST('2016' as DATETIME)

    SELECT CAST(2016 AS DATETIME)

    The first, converting a string to datetime, is assumed to be the first of January of the year specified. The second, converting an integer to datetime, is assumed to be the number of days since 1900-01-01

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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