Sql存储过程中判断某个数据表的某一行的某列的值是否为NUll

来源:互联网 发布:五金进入货软件 编辑:程序博客网 时间:2024/05/16 00:45


存储过程:

Create procedure ceshi_Group_Qxid_Update    //创建存储过程

@GroupId int,  //参数
@content varchar(Max)  //参数
as
if exists( select *  from  ceshi_Group where  QxId  is   null and GroupId=@GroupId)//判断该行是否存在
begin
update ceshi_Group set QxId=@content+',' where GroupId=@GroupId

end

else
begin
update ceshi_Group set QxId=Qxid+@content+',' where GroupId=@GroupId
end

select *  from  ceshi_Group where  QxId  is   null        //判断QxId为null值得行是否存在

0 0
原创粉丝点击