Hi
i have written a stored procedure using cursor.I know we should avoid using cursors whenever possible.I think this sp could be written without using cursor but have no clue. any help will be appreciable.
here is my original sp..hope this could explain the problem..
declare c1 cursor local for
select ResourceId from viewItems where viewId=@viewId
declare @id int
open c1
fetch next from c1 into @id
while @@fetch_status=0
begin
insert into ##temp (BookingId,Name,start,finish,Resource)
select BookingId,Name,start,finish,Resource from Bookings where ResourceId=@id
fetch next from c1 into @id
end
thanks
i have written a stored procedure using cursor.I know we should avoid using cursors whenever possible.I think this sp could be written without using cursor but have no clue. any help will be appreciable.
here is my original sp..hope this could explain the problem..
declare c1 cursor local for
select ResourceId from viewItems where viewId=@viewId
declare @id int
open c1
fetch next from c1 into @id
while @@fetch_status=0
begin
insert into ##temp (BookingId,Name,start,finish,Resource)
select BookingId,Name,start,finish,Resource from Bookings where ResourceId=@id
fetch next from c1 into @id
end
thanks