T-SQL: How to update just date part of datetime field?

后端 未结 1 1992
终归单人心
终归单人心 2021-01-02 10:10

In SQL Server 2008 I need to update just the date part of a datetime field.

In my stored procedure I receive the new date in datetime format. From this parameter I h

1条回答
  •  萌比男神i
    2021-01-02 11:01

    One way would be to add the difference in days between the dates to the old date

    UPDATE TABLE
    SET  = dateadd(dd,datediff(dd,,@newDate),)
    WHERE ...
    

    0 讨论(0)
提交回复
热议问题