Using below code you can learn, how to use cursor in Stored Procedure
DECLARE @dListingEnddate datetime
DECLARE cur_enddate1 CURSOR FOR( select top 10 dListingEnddate as dListingEnddate from jau_productmaster)
/* Open Corsor */
OPEN cur_enddate1
FETCH NEXT From cur_enddate1 INTO @dListingEnddate
WHILE @@Fetch_Status = 0
BEGIN
/*Put your sql query here*/
--INSERT INTO GK_ShareEvent (iShareEventID,iEventAudienceID)
--VALUES(@iEventID,@iEventAudienceID)
FETCH NEXT From cur_enddate1 INTO @dListingEnddate
END
/* Close Corsor */
CLOSE cur_enddate1
DEALLOCATE cur_enddate1
END
-------------------------------------------------------------------------------------------
Hope this post will help you,
if yes please put comment below of this page,
Rajesh Singh,
Asp.Net Developer
Indianic Infotech Ltd (India)
rajesh@indianic.com
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment