查询:
wait_time
这就是我想要的,但我收到转换错误
我告诉你wait_time = CONVERT(VARCHAR, DATEDIFF(Hour, time_created, time_responded) % 24) + '.'
+ CONVERT(VARCHAR, DATEDIFF(minute, time_created, time_responded) % 60)
是
19.07
输出为:UPDATE dbo.FinalExtract
SET WEWE = CASE
WHEN Wait_time <= '24'
THEN CONVERT(varchar, dateadd(hour, -24, Wait_time))
ELSE CONVERT(varchar, dateadd(hour, +24, Wait_time))
END
如果输出值小于24小时,我想增加+24小时,如果输出值超过24小时,则需要额外增加24小时。
我试过这个
docker inspectimage imagename
但它无效我收到转换错误。
答案 0 :(得分:0)
时间部分应该有冒号。你的wait_time应该是
wait_time = CONVERT(VARCHAR, DATEDIFF(Hour, time_created, time_responded) % 24) + ':'
+ CONVERT(VARCHAR, DATEDIFF(minute, time_created, time_responded) % 60)
答案 1 :(得分:0)
我认为这会对你有所帮助:
Declare @timeCreated datetime='2016-06-09 12:26:12.000'
Declare @timeresponded datetime='2016-06-09 14:28:12.000'
declare @waittime datetime;
set @waittime=(select case when DateDiff(hh,@timeCreated,@timeresponded) < 24 then DateDiff(hh,@timeCreated,@timeresponded) + 24else DateDiff(hh,@timeCreated,@timeresponded) end)
update dbo.finalextract set wewe=@waittime