sqlserver cursor

ALTER

procedure [bouser].[InsertTransfer_delete]

as

declare @form_no asvarchar(50)declare @from_br asvarchar(50)declare @to_br asvarchar(1000)declare @reccount asinteger

 

set @reccount = 0declare iws_transfr_detail_cursor cursorforselect form_no, from_br, to_br from dbo.iws_transfr_detail

 

open iws_transfr_detail_cursorfetchnextfrom iws_transfr_detail_cursor into @form_no, @from_br, @to_brwhile@@FETCH_STATUS= 0Begin

 

UPDATE IWF_RequestDetails SET NewBranchCode = @from_br , OldBranchCode = @to_brwhere FormNo = @form_noset @reccount = @reccount + 1fetchnextfrom iws_transfr_detail_cursor into @form_no, @from_br, @to_br

 

print @reccountEndclose iws_transfr_detail_cursordeallocate iws_transfr_detail_cursor

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: