本帖最后由 x2xnet 于 2011-06-19 10:26:30 编辑

解决方案 »

  1.   

    declare @s varchar(1000)
    set @s = 'select fh_'+right('00'+datepart(hh,getdate()),2)+' from nowt '
    exec(@s)
      

  2.   


    declare @s varchar(1000)
    set @s = 'select fh_'+right('00'+datepart(hh,getdate()),2)+' from nowt '
    print(@s)
    --select fh_10 from nowt 
      

  3.   


    ---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  与计算机的时间同步。
      

  4.   

    set @s = 'select fh_'+right('00'+datepart(hh,getdate()),2)+' from nowt where now in(''movx'',''movs'')'
      

  5.   

    set @s = 'select fh_'+right('00'+datepart(hh,dateadd(hh,-1,getdate())),2)+' from nowt where now in(''movx'',''movs'')'