求 判断语句写法
create trigger T_aaa
on biao_1
for insert
AS
DECLARE @sl int,@mc nvarchar(20)
SELECT @mc=mc,@sl=sl FROM inserted
select id from sz_biao where ss_mc=@mc
判断假如 sz_biao 表记录等于空,执行插入,否则,更新
begin
INSERT INTO sz_biao (ss_sl, ss_mc)
VALUES (@sl,@mc)
end
Else
begin
UPDATE sz_biao
SET ss_sl=ss_sl+@sl where ss_mc=@mc
end
请教大侠,这判断语句如何写?
------解决方案--------------------if (select count(1) from sz_biao where ss_mc=@mc) >0