eg:
insert 表2 (字段1,字段2,字段3) Select 字段3,cast(字段5 as int),字段8 
from 表1 where 字段6>=100

解决方案 »

  1.   

    insert 表1 (列1,列2) select 列1,列2 from 表2
      

  2.   

    如果楼上的还不能满足要求那么dts则是最终选择:
    右健数据库,所有任务,到处数据,
    在“选择源表和视图”步,点击哪个灰色的转换按钮,然后点击转换页
    选择“在将信息复制到目的时对其进行转换”里面可以鞋vbscript对转换进行详细控制
    dts很强大的!
      

  3.   

    Insert into 服务器.数据库.dbo.表1 (字段1,字段2,字段3)
    Select 服务器.数据库.dbo.字段4,字段5,字段6 from 表2
      

  4.   

    写错了,应为
    Insert into 服务器.数据库.dbo.表1 (字段1,字段2,字段3)
    Select 字段4,字段5,字段6 from 服务器.数据库.dbo.表2
      

  5.   

    insert 表1(列1,列2,列3,列4) select 列1,列2,56,'常量' from 表2
      

  6.   

    谢谢大力..但现在又有问题了..以前的数据库设计人员没有为该表建个主键...ID无法插入..还有这表里还有重复的记录..包含text字段.郁闷啊...大力帮帮我啊..先告我怎么样把重复的记录删掉了!!!!
      

  7.   

    insert 表1 (列1,列2) select 列1,列2 from 表2
    这应该就可以了
      

  8.   

    去除重复值
    如果有ID字段,就是具有唯一性的字段delect table where id not in (  select max(id) from table group by col1,col2,col3...
    )
    group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同。2,如果是判断所有字段也可以这样
      select * into #aa from table group by id1,id2,....
      delete table 
      insert into table 
      select * from #aa3,没有ID的情况select identity(int,1,1) as id,* into #temp from tabel
    delect # where id not in (
      select max(id) from # group by col1,col2,col3...)
    delect table
    inset into table(...)
       select ..... from #temp
    col1+','+col2+','...col5 联合主键
    select * from  table where col1+','+col2+','...col5 in (  select max(col1+','+col2+','...col5) from table 
    where having count(*)>1
    group by col1,col2,col3,col4 
    )
    group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同。2,
    select identity(int,1,1) as id,* into #temp from tabel
    select * from  #temp where id in (
      select max(id) from #emp where having count(*)>1 group by col1,col2,col3...)
      

  9.   

    TO:楼上的..我用了..delect info where id not in (select max(id) from info group by id)
    提示'where' 附近有语法错误。
    表info..的id为numeric类型..还有text类型的content字段
    比如
        id,content
    1    23,中华人民共和国
    2    24,国
    3    23,中华人民共和国
    4    24,国
    这种该怎么删除重复的记录啊.
      

  10.   

    delete info where id not in (select max(id) from info group by cast(content as varchar(8000)))
      

  11.   

    insert 表2 (字段1,字段2,字段3) Select 字段3,cast(字段5 as int),字段8 
    from 表1