我开始编写存储过程:
CREATE PROCEDURE [dbo].[sp_prepare_data]
@SubjectId INT
AS
BEGIN
END
如果传递给存储过程的SubjectId 不 100,200或300,我怎样才能使存储过程返回RC为99?
答案 0 :(得分:1)
CREATE PROCEDURE [dbo].[usp_prepare_data] --<-- Use usp_ instead of sp_
@SubjectId INT
AS
BEGIN
IF(@SubjectId = 100 OR @SubjectId = 200 OR @SubjectId = 300)
BEGIN
-- Your code goes here
END
ELSE
BEGIN
RETURN 99;
END
END