SQL server if else怎么使用

这个是触发器的一部分,有些小问题,因为if括号里面的语句不是布尔类型的,怎么样 设置为布尔类型的, 其中if中语句的意思 说:只要A1表里面含有auth_info 则执行下面的插入语句
if (select count(*) from A1 where dic like '%auth_info%')
begin
insert into UserBase(userid,stamp,identify,stbid,usertoken,createtime,other)values(@v_userid,@v_stamp,@v_identify,@v_stbid,@v_usertoken,@v_createtime,'');
end

第1个回答  推荐于2016-04-29
if (select count(*) from A1 where dic like '%auth_info%')>0
或者
if exists(select * from A1 where dic like '%auth_info%')本回答被提问者采纳