insert 新表
select a, b, c, '2005' from table1

解决方案 »

  1.   

    insert into TABLE1 (A,B,C,D)
    select replace(a,'2004','2005'),b,c,d from TABLE1
      

  2.   

    insert into TABLE1 (A,B,C,D)
    select a,b,c,replace(d,'2004','2005') from TABLE1
      

  3.   

    d列为int类型
    insert into tb1 (A,B,C,D)
    select a,b,c,d+1 from tb2
    d列为char类型
    insert into tb1 (A,B,C,D)
    select a,b,c,cast(cast(d as numeric)+1) as varchar) from tb2
      

  4.   

    d列为char类型insert into tb1 (A,B,C,D)
    select a,b,c,cast(cast(d as numeric)+1 as varchar) from tb2
      

  5.   

    update table TABLE1 
    set d='同一个值'
      

  6.   

    update TABLE1 set d=XXX
      

  7.   

    回chenqianlong(443) ,feitianbianfu16()
    我的意思是说
    例如:表TABLE1 有A,B,C,D 4列, D列的值不同 ,我希望插入将所有当前数据复制,年份值变为同一个值,其他的不变,保存在当前表中,这个怎么做
      

  8.   

    insert table1
    select a, b, c, '2005' from table1
      

  9.   

    很简单。第一条回复就不错嘛
    回复人: filebat(Mark) ( ) 信誉:100  2005-07-21 13:03:00  得分: 0 insert into table1
    select a, b, c, d=2005 from table1或者你可以用下面的测试一下:
    select 'a' a, 'sdfsd' b, 'fds' c, 2004 d
    union select 'b' a, 'sdfsd' b, 'fdfds' c, 2004 d
    union select 'c' a, 'sdfsdfsd' b, 'fddfs' c, 2004 d
    union select 'd' a, 'sdfsdfsd' b, 'fddfs' c, 2003 d
    select 'a' a, 'sdfsd' b, 'fds' c, 2004 d
    union select 'b' a, 'sdfsd' b, 'fdfds' c, 2004 d
    union select 'c' a, 'sdfsdfsd' b, 'fddfs' c, 2004 d
    union select 'd' a, 'sdfsdfsd' b, 'fddfs' c, 2003 dunion select a,b,c,2005 d from (
    select 'a' a, 'sdfsd' b, 'fds' c, 2004 d
    union select 'b' a, 'sdfsd' b, 'fdfds' c, 2004 d
    union select 'c' a, 'sdfsdfsd' b, 'fddfs' c, 2004 d
    union select 'd' a, 'sdfsdfsd' b, 'fddfs' c, 2003 d) b/******************************************************************
    执行结果为:
    a    b        c     d           
    ---- -------- ----- ----------- 
    a    sdfsd    fds   2004
    b    sdfsd    fdfds 2004
    c    sdfsdfsd fddfs 2004
    d    sdfsdfsd fddfs 2003a    b        c     d           
    ---- -------- ----- ----------- 
    a    sdfsd    fds   2004
    a    sdfsd    fds   2005
    b    sdfsd    fdfds 2004
    b    sdfsd    fdfds 2005
    c    sdfsdfsd fddfs 2004
    c    sdfsdfsd fddfs 2005
    d    sdfsdfsd fddfs 2003
    d    sdfsdfsd fddfs 2005******************************************************************/