if Exists (Select * From T1 Where UserID = @UserID)
begin
  Insert T2 ....
end

解决方案 »

  1.   

    insert into 表2 select * from 表1 where userid in (select userid from 表2)
      

  2.   

    insert into 表2 select * from 表1 where userid in (select userid from 表2)
    这句应该是将表1中的记录也存在与表2中,将这些记录插入不知道楼主到底是什么意思。
      

  3.   

    在表2中的USERID创建一个外键约束
      

  4.   

    alter table table2 add constraint sonstraintname foreing key references table1(USEID)