如果确实重复,就用distinctinsert into cityt(id,code) select distinct id,code from province  where id=18 

解决方案 »

  1.   

    SET IDENTITY_INSERT cityt ON  
      insert into cityt(id,code) select id,code from province  where id not in(select id from cityt)
      SET IDENTITY_INSERT cityt OFF
      

  2.   

    你的ID是的Int类型  标识为是  的自动编号还重复就奇怪了.
      

  3.   

    insert into cityt(code) select code from province  where id=18 
      

  4.   

    〉〉insert into cityt(code) select code from province  where id=18 SET IDENTITY_INSERT cityt ON  只是让你可以在该字段插入数据,而不是帮你自动更改字段数字。
      

  5.   

    create table t1(id int identity,a int)
    insert t1 values(1)
    insert t1 values(2)dbcc checkident ( 't1', reseed,1)
    insert t1 values(3)
    select * from t1ID A
    1 1
    2 2
    2 3想不重复,可以不改 identity_insert,就用insert into cityt(code) select code from province  where id=18