34,588
社区成员
发帖
与我相关
我的任务
分享
if not exists(select 1 from t1 where id=2)
insert into t1 values(xx)
if not exists(select * from tableName where colname=@name)
begin
insert into tab(..) select ...
end
if exists(select 1 from t1 where id='2')
print '不能添加'
--如果存在
if exists(select 1 from A where A_1='XX')
begin
end