开发者

How can I make change for existing date value in SQL Server into new value?

开发者 https://www.devze.com 2023-01-06 14:19 出处:网络
Does anyone know how can I make change for existing date value in SQL Server into new value? Example: Declare @StartDate DATETIME; SET @StartDate = \'2010-07-07 00:00:00\'

Does anyone know how can I make change for existing date value in SQL Server into new value?

Example:

Declare @StartDate DATETIME; SET @StartDate = '2010-07-07 00:00:00'

Which I hope to declare another variable @DATETIME2 DATETIME based on @StartDate value c开发者_JAVA百科hanged into '2010-07-07 08:00:00' instead of default manually hard code it


Use the DateAdd() function:

DECLARE @DateTime2 DateTime; Set @DateTime2 = DATEADD(hh, 8, @StartDate)
0

精彩评论

暂无评论...
验证码 换一张
取 消