一个简单的存储过程

来源:互联网 发布:网络的优缺点英语作文 编辑:程序博客网 时间:2024/05/23 01:14

 SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

 

ALTER    procedure List_gz (@p_zgh int = null)
as
begin

     if @p_zgh is null

        begin

            print '请输入一个职工号 '

            return

        end

     else
begin

            select *

from  ttt 

            where seq=@p_zgh

         end

end;

 

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

调用

DECLARE @RC int
DECLARE @p_zgh int -- 设置参数值
set @p_zgh=11
EXEC @RC = [tempdb].[dbo].[List_gz] @p_zgh