declare @s varchar(1000) set @s = 'select fh_'+right('00'+datepart(hh,getdate()),2)+' from nowt ' exec(@s)
declare @s varchar(1000) set @s = 'select fh_'+right('00'+datepart(hh,getdate()),2)+' from nowt ' print(@s) --select fh_10 from nowt
---0:2时执行 SELECT FH_01 FROM NOWT WHERE NOW IN ('MOVX','MOVS') --01表示1时---0:3时执行 SELECT FH_02 FROM NOWT WHERE NOW IN ('MOVX','MOVS') --02表示2时---0:4时执行 SELECT FH_03 FROM NOWT WHERE NOW IN ('MOVX','MOVS') --03表示3时--怎样使 FH_XX 与计算机的时间同步。
set @s = 'select fh_'+right('00'+datepart(hh,getdate()),2)+' from nowt where now in(''movx'',''movs'')'
set @s = 'select fh_'+right('00'+datepart(hh,dateadd(hh,-1,getdate())),2)+' from nowt where now in(''movx'',''movs'')'
set @s = 'select fh_'+right('00'+datepart(hh,getdate()),2)+' from nowt '
exec(@s)
declare @s varchar(1000)
set @s = 'select fh_'+right('00'+datepart(hh,getdate()),2)+' from nowt '
print(@s)
--select fh_10 from nowt
---0:2时执行
SELECT FH_01 FROM NOWT WHERE NOW IN ('MOVX','MOVS') --01表示1时---0:3时执行
SELECT FH_02 FROM NOWT WHERE NOW IN ('MOVX','MOVS') --02表示2时---0:4时执行
SELECT FH_03 FROM NOWT WHERE NOW IN ('MOVX','MOVS') --03表示3时--怎样使 FH_XX 与计算机的时间同步。