September 21, 2005 at 3:16 pm
Hello Friends...
Sorry for this question but... I do not have alternative.
I have a Table... [AnyTable]
I need all the data of this table to work during all the store procedure.
--Then I do this:
DECLARE CUR_Trn_to_Upd_Status CURSOR
LOCAL FOR
SELECT * FROM [AnyTable] where IDC = 878
At the Inictial place of the Procedure I need to obtain the value of 2 fields from this cursor.
--Open the Cursor Generated
OPEN CUR_Trn_to_Upd_Status
--Obtains all the Necesary Variables to Work With
FETCH NEXT FROM CUR_Trn_to_Upd_Status
INTO @V_cStatus, @V_dStatus
This is one error because the table have more than this 2 fields.
--Like this cCarId, cCarOfId, cCarCons, cPS, cReceno, cStatus, dStatus
--There is any way of obtain just the 2 values? @V_cStatus, @V_dStatus?
--But having avaliable the others fields for futures Asignations?
With Out make one insert into for all the fields.
Somethis like that.
FETCH NEXT FROM CUR_Trn_to_Upd_Status
INTO @V_cCarId, @V_cCarOfId, @V_cCarCons, @V_cPS, @V_cReceno, @V_cStatus, @V_dStatus
September 21, 2005 at 3:39 pm
Why not just change your statement
SELECT * FROM [AnyTable] where IDC = 878
to
SELECT column1, Column2 FROM [AnyTable] where IDC = 878
And, dude - don't used cursors they suck for performance.
A.J.
DBA with an attitude
September 21, 2005 at 4:17 pm
Becasue I need to use the where is diferent but always I need to get the sama records.
Also I need Update teh cursor base on the cursor.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply