insert into 表(col1,col2.....自增字段不要加入)
select col1,col2..,dateadd(month,1,日期字段),...自增字段不要加入 from 表 where convert(char(7),日期字段,120)='2003-08'对应的日期字段作一下处理,如上

解决方案 »

  1.   

    update yourtable set datecol='2003-09-15' where convert(varchar,datecol,102)='2003.08.15'
      

  2.   

    select into #tt from yourtable
    where datediff(day,日期字段,'20030815') = 0update #tt set 日期字段 = '20030915'insert into yourtable 
    select * from #tt
    ok
      

  3.   

    请问lwwxf(朋友)提到的#tt是指什么啊,记录集吗
    有个问题,用insert selectfrom命令好象不能是两个相同名字的 表啊
      

  4.   

    我是在表gongzi中操作
    我的代码该怎么写呢
    是insert into gongzi.姓名,gongzi。基础工资,gongzi。月份 select 姓名,基础工资,月份 from gongzi where 月份=8
    还是insert into 姓名,基础工资,月份 select 姓名,基础工资,月份 from gongzi where 月份=8呢
      

  5.   

    我是这样写程序的
    insert into gongzi select 姓名,基础工资,2003-8-15 from gongzi where 月份=2003-9-15,得到的结果应该是将原来月份中的2003-9-15替换为2003-8-15保存到数据库中,但发现在数据库中新插入记录的月份字段的值变成了1905-6-4了,这是怎么回事呢,有谁知道吗?
      

  6.   

    是這樣的﹕
    insert into gongzi select 姓名,基础工资,'2003-9-15' from gongzi where 月份=8 and 年份=2003