直接选出来,改变!!!
insert into tablename(id,datetime1,...) select (id,getdate(),...) from tablename1 where 
datetime1=昨天日期
getdate()----今天日期

解决方案 »

  1.   

    insert tablename(日期字段,其他字段列表) 
    select convert(char(10),getdate(),120),其他字段列表 from tablename1 
    where 日期字段>=dateadd(day,-1,convert(char(10),getdate(),120))
        and 日期字段<convert(char(10),getdate(),120)
      

  2.   

    --用作业定时处理企业管理器
    --管理
    --SQL Server代理
    --右键作业
    --新建作业
    --"常规"项中输入作业名称
    --"步骤"项
    --新建
    --"步骤名"中输入步骤名
    --"类型"中选择"Transact-SQL 脚本(TSQL)"
    --"数据库"选择执行命令的数据库
    --"命令"中输入要执行的语句
    insert tablename(日期字段,其他字段列表) 
    select convert(char(10),getdate(),120),其他字段列表 from tablename1 
    where 日期字段>=dateadd(day,-1,convert(char(10),getdate(),120))
        and 日期字段<convert(char(10),getdate(),120) --确定
    --"调度"项
    --新建调度
    --"名称"中输入调度名称
    --"调度类型"中选择你的作业执行安排
    --如果选择"反复出现"
    --点"更改"来设置你的时间安排
    然后将SQL Agent服务启动,并设置为自动启动,否则你的作业不会被执行设置方法:
    我的电脑--控制面板--管理工具--服务--右键 SQLSERVERAGENT--属性--启动类型--选择"自动启动"--确定.
      

  3.   

    Insert TableName (Col1,Col2,...日期字段) Select Col1,Col2,...,GetDate() from TableName Where  DateDiff(d,日期字段,GetDate())=1
      

  4.   

    insert into 表(字段1,字段2,日期)
    select 字段1,字段2,dateadd(day,1,日期) from 表
    where convert(varchar(10),日期,120)=convert(varchar(10),dateadd(day,-1,getdate()),120)
      

  5.   

    thank u 你们动作好快!
      

  6.   

    1.昨天的数据还需要保留
    insert into t select dateadd(day,1,时间字段名) from t where datediff(day,时间字段名,getdate())=1
    2.昨天的数据不保留
    update t set 时间字段名=dateadd(day,1,时间字段名) where datediff(day,时间字段名,getdate())=1