原来库中已经有四月份的工资
我现在要把四月份改成五月份插入到原来的表中,其他的不变。这个语句怎么写呀?

解决方案 »

  1.   


    insert tb(datefield,...) 
    select dateadd(mm, 1, datefield),... from tb where year(datefield)=2008 and month(datefield)=4
      

  2.   

    update tb set 時間字段=dateadd(month,1,時間字段)
      

  3.   


    insert into 工资表 select '5月',除月份外其它字段 from 工资表 where 月份='4月'
      

  4.   


    insert into 工资表 
    select '5月',工资 
    from 工资表 where 月份='4月'
      

  5.   

    有點疑問,是一張表update還是從別的表中插入?
      

  6.   

    insert into 工资表 select '5月' from 工资表 where 月份='4月'
      

  7.   

    update tableset wage = @wage,
        month = '5'
    where month = '4' 
     
      

  8.   

    如果没有5月份的记录insert into 工资表 (月份,其他字段)
    select '5月',其他字段
    from 工资表 
    where 月份='4月'如果有5月份的空记录update 工资表 
    set 工资表.其他字段 = a.其他字段
    from 工资表 a
    where 工资表.月份='5月'
    and a.月份='4月'
    and 工资表.人员编号 = a.人员编号
      

  9.   

    我的表中还有一个标识列
    我在插入的时候提示:当IDENTITY_INSERT设置为OFF时,不能向表中的标识列插入显式值
      

  10.   

    select *   into #tmp from 工资表 where 月份=‘四月’insert into 工资表
    (月份,......) 
    select 
    月份='五月',...... from #tmp
      

  11.   

    select *   into #tmp from 工资表 where 月份=‘四月’insert into 工资表
    (月份,......) 
    select 
    月份='五月',...... from #tmp
      

  12.   

    select *   into #tmp from 工资表 where 月份=‘四月’insert into 工资表
    (月份,......) 
    select 
    月份='五月',...... from #tmp