0

Hai,

I Have an sp like this:

ALTER procedure [dbo].[SP_ClassInsertion]
@ClassType varchar(50),
@ClassTypeId varchar(50),
@ClassName varchar(50),
@SchoolId varchar(50),
@ClassID  varchar(50),
@BatchId  varchar(50),
@Userid uniqueidentifier,
@ClassCategoryId varchar(50),
@SchoolClassCategoryId varchar(50)

as

declare @STATUS  int

begin
if exists(select Class_Id from SCH_Class where Class_Name=@ClassName  and School_Id=@SchoolId and Is_Valid=1)
begin
set @STATUS=0
end

else
begin


insert into  SCH_Class  (Class_Id,Class_Type_Id,Batch_Id,School_Id,Class_Name,Created_Date,Updated_Date,Created_By,Updated_By,Is_Valid) values (@ClassID,@ClassTypeId,@BatchId,@SchoolId,@ClassName,GetDate(),GetDate(),@Userid,@Userid,1)


set @STATUS=1

return @STATUS
end

Can u please help me to execute this sp and get the return value from it.

Regards,
sreevidya

3
Contributors
7
Replies
10
Views
5 Years
Discussion Span
Last Post by ssreevidya.m
0
DECLARE @RET int

DECLARE @ClassType varchar(50)
DECLARE @ClassTypeId varchar(50)
DECLARE @ClassName varchar(50)
DECLARE @SchoolId varchar(50)
DECLARE @ClassID  varchar(50)
DECLARE @BatchId  varchar(50)
DECLARE @Userid uniqueidentifier
DECLARE @ClassCategoryId varchar(50)
DECLARE @SchoolClassCategoryId varchar(50)

-- TODO: Set parameter values here.

EXECUTE @RET = SP_ClassInsertion
  @ClassType,
  @ClassTypeId,
  @ClassName,
  @SchoolId,
  @ClassID,
  @BatchId,
  @Userid,
  @ClassCategoryId,
  @SchoolClassCategoryId

GO
0

Hai ,
Thank you for your replay.
I execute the sp successfully , But how can i get the @RET as output.

0

change this part:

ALTER procedure [dbo].[SP_ClassInsertion]
@ClassType varchar(50),
@ClassTypeId varchar(50),
@ClassName varchar(50),
@SchoolId varchar(50),
@ClassID  varchar(50),
@BatchId  varchar(50),
@Userid uniqueidentifier,
@ClassCategoryId varchar(50),
@SchoolClassCategoryId varchar(50)

as

declare @STATUS  int

begin...

to

ALTER procedure [dbo].[SP_ClassInsertion]
@ClassType varchar(50),
@ClassTypeId varchar(50),
@ClassName varchar(50),
@SchoolId varchar(50),
@ClassID  varchar(50),
@BatchId  varchar(50),
@Userid uniqueidentifier,
@ClassCategoryId varchar(50),
@SchoolClassCategoryId varchar(50),
@STATUS  int OUTPUT
as 
begin...
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.