Click here to Skip to main content
15,884,810 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
set 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),@tempitems varchar(max)

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

declare studcur cursor for

select @tempitems = items from Fnsplit(@AllStud_id,',')
open studcur
fetch next from studcur into @Stud_id

WHILE @@fetch_status = 0
begin

set @status = OH_Course_Reg(@tempitems,@BatchID,@UserID)
insert into Temptable values(@tempitems,@status)

fetch next from studcur into @Stud_id
end

close studcur
deallocate studcur

select * from #Temptable
end


When i execute the above store procedure shows error as follows

variable assignment is not allowed in a cursor declaration

The above error shows in below line as follows
select @tempitems = items from Fnsplit(@AllStud_id,',')

please help me. how can i solve the problem.

Regards,
Narasiman P
Posted

1 solution

the error is on this line bellow:
insert into Temptable values(@tempitems,@status)

replace it for this:
insert into #Temptable values(@tempitems,@status)


Best Regards,


Leonardo Metre
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900