~~~~~用存储过程实现以下功能,大家帮忙~~~~~~` 
选择出用户的注册时间  表 :A  字段 : regtime
 判断出用户注册时间到当前时间是否有一个月或2个月3,4,   //也就是每个月更新用户的资料
 有的话更新用户的发送次数 num 为0  每个月如此现在要解决的就是,怎么去判断时间请大家帮忙

解决方案 »

  1.   

    现在要解决的就是,怎么去判断时间
    --->
    declare @result intselect @result  = datediff(mm,getdate(),regtime) from Aif(@result = 1)........
      

  2.   

    看你的条件好像是这样
    if(@result > 1)
     update ..........mm = 0
      

  3.   

    brightheroes(闭关|那一剑的风情) 
     
    我看看
      

  4.   

    update table set num = 0 where datediff(mm,regtime,getdate())>1
      

  5.   

    嗯,诚如楼上所言,的确是一个UPDATE就可以搞定
      

  6.   

    如果是要实现,就做个JOB吧,每天刷新表一次,对时间做判断
    declare @result intselect @result  = datediff(mm,getdate(),regtime) from Aif(@result = 1)........(借用楼上代码^-^)对符合条件的用户进行UPDATE
      

  7.   

    update vipinfo set sendnum = 0 where DATEPART(mm,getdate())=DATEPART(mm,regtime) and feeid=@p0谢了上面的几位
    但在比较日期上还是有问题
    我最后换了这种方法
    我存入时间的格式默认的是04-10-22 下午 04:23:41
    不知道为什么比较就失败