写好实现的存储过程,放到SQLSERVER作业里,设定参数。

解决方案 »

  1.   

    job:update 用户信息表
     set 过期的标识位=1
    where 截止日期字段<=getdate()
      

  2.   

    getdate()取到的时间是包含小时分钟秒的我只要取到天就可以了,应该怎么写代码啊!!!!!
      

  3.   

    只取天用convert转换了:
    where convert(char(10),截止日期字段,121)<=convert(char(10),getdate(),121)
      

  4.   

    对,用JOB设定每天执行,再JOB写上更新语句
    天 day(getdate())
      

  5.   

    Yang_(扬帆破浪) (  )  + : cdzydgyr() 就是比较完美的结果了
    OpenVMS(半知半解)的有问题,如果某人6月8日过期而现在是5月19的话,那这人早在5月8日就过期了。
    job:
    (注:过期标识位 1 过期 0 未过期)
    update 用户信息表
     set 过期的标识位=1
    where convert(char(10),截止日期字段,121)>=convert(char(10),getdate(),121)
    或者:
    update 用户信息表
     set 过期的标识位=1
    where year(截止日期字段)=year(getdate()) and month(截止日期字段)=month(getdate() and day(截止日期字段)>=day(getdate())
      

  6.   

    呵呵,时间是用了<=的,不必要精确的。比如你设定时间是2002-1-1,那只要过了这个时间就算过期了,更新它为过期就可以了。如果怕更新量大就改为:update 用户信息表
     set 过期的标识位=1
    where 截止日期字段<=getdate()
    and 过期的标识位<>1
      

  7.   

    create proc pro_1
    as
    update information
    set money=0
    where enddate<=convert(char(10),getdate(),121)
    是我写的存贮过程怎么可以让它每天都执行,请写出具体的办法!!
      

  8.   

    SQL ENTERPRISE MANAGER---managment-sql server agent--jobs
    这里可看到你所做的所有JOB.
    选择新建JOB,会有向导领着你一步步的做完.选择一个JOB右击,在菜单中可选择START JOB,STOP JOB,VIEW JOB HISTORY....
      

  9.   

    FAQ:
    http://www.csdn.net/Expert/FAQ/FAQ_Index.asp?id=137
      

  10.   

    FAQ:
    http://www.csdn.net/Expert/FAQ/FAQ_Index.asp?id=137