CREATE PROCEDURE dbo.p_mov_nsrxx 
AS 
    BEGIN 
    insert into DJ_NSRXX 
    select * from ctais..DJ_NSRXX 
    where  NSRSBH not in (select NSRSBH from DJ_NSRXX)
    END

解决方案 »

  1.   

    insert into DJ_NSRXX select * from ctais..DJ_NSRXX b,DJ_NSRXX c
        where c.关联字段=b.关联字段 and c.NSRSBH not in (select distinct NSRSBH from DJ_NSRXX)
      

  2.   

    bely_zhou的应该可以了
    CREATE PROCEDURE dbo.p_mov_nsrxx 
    AS 
        BEGIN 
        insert into DJ_NSRXX select * from ctais..DJ_NSRXX  
        where  not exist
            (select * from DJ_NSRXX A,ctais..DJ_NSRXX  B 
             where A.DJ_NSRXX=B.NSRSBH
            )