首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求 判判案句写法

2013-03-04 
求 判断语句写法create trigger T_aaaon biao_1for insertASDECLARE @sl int,@mc nvarchar(20)SELECT @mc

求 判断语句写法
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

热点排行
Bad Request.