一个简单的存储过程

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

你可能感兴趣的:(存储过程)