不好意思,看错了,
建立链接服务器,然后insert into(…)select * from 链接服务器名.库名.dbo.表名

解决方案 »

  1.   

    SET IDENTITY_INSERT DB1.dbo.tbl ON 
    Go
    Insert into DB1.dbo.tbl
    Select *from DB1.dbo.tbl where CID not in 
    (Select CID from DB.dbo.tbl)
    GO
    SET IDENTITY_INSERT DB1.dbo.tbl OFF
    GOCID是identity类型
      

  2.   

    写错了SET  IDENTITY_INSERT  DB1.dbo.tbl  ON    
    Go  
    Insert  into  DB1.dbo.tbl  
    Select  *from  DB.dbo.tbl  where  CID  not  in    
    (Select  CID  from  DB1.dbo.tbl)  
    GO  
    SET  IDENTITY_INSERT  DB1.dbo.tbl  OFF  
    GO  
     
    CID是identity类型 
    报错
    消息 8101,级别 16,状态 1,第 1 行
    仅当使用了列列表并且 IDENTITY_INSERT 为 ON 时,才能为表'DB1.dbo.tbl'中的标识列指定显式值。