narasiman rao

narasiman rao

  • NA
  • 519
  • 772k

i tried but in my stored procedure output is getting correct

Sep 16 2014 12:02 PM
 
 I written the one stored procedure called OH_CourseReg
When i run the OH_CourseReg Procedure output as follows
There is no available seats


I am using the OH_CourseReg procedure in the below stored procedure.

et ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

ALTER proc [dbo].[OH_Bulkbooking_Course](@AllStud_id varchar(max),@BatchID varchar(20),@UserID varchar(30))
as
begin
declare @Stud_id varchar(20),
@status varchar(max),
@Checkstudent varchar(20)

create table #Temptable (Stud_id varchar(20),status varchar(max))

begin tran
declare studcur1 cursor for
select items from Fnsplit(@AllStud_id,',')
open studcur1
fetch next from studcur1 into @Stud_id

WHILE @@fetch_status = 0
begin
declare @err varchar(50)
exec @Status = [OH_CourseReg] @Stud_id,@BatchID,@UserID

insert into #Temptable (Stud_id, status) values (@Stud_id, @Status)
insert into Tb_Bulk_Booking_Track (Stud_id,Batchid,Username) values (@Stud_id,@BatchID,@UserID)
fetch next from studcur1 into @Stud_id
end

close studcur1
deallocate studcur1
commit tran

select * from #Temptable
end

When i execute the stored procedure as follows

exec [OH_Bulkbooking_Course] '21454','B14259','NS'

output as follows

Err
There is no available seats


Stud_id status
21454 0


I want correct output as follows

Stud_id status
21454 There is no available seats

in status i want the there is no available seats

i want first procedure output in second procedure