I have tried to figure this out for a couple of days now and I'm not
making much headway. I have a cursor that I can't get to work
properly. There are two cursors in the stored procedure. The first
accesses data in the current database and works fine. The second
accesses data in another database on the same server. Whenever I
fetch rows into the second cursor (other database) the variables I
fetch into remain NULL.
I have included excerpts from the stored procedure. The whole
procedure is about 300 lines long so I only included a little snippet.
Thanks for any help you can provide.
DECLARE @v_salesOrderLine char(3),
@v_endItemNumber char(25),
@v_endItemRev char(3),
@v_dueDate datetime,
@v_orderQty decimal(15,5),
@v_endItemPrice decimal(17,5)
DECLARE c_salesOrderLineItems CURSOR
FOR SELECT fenumber,
fpartno,
fpartrev,
fduedate,
forderqty,
funetprice
FROM m2mdata05.dbo.sorels
WHERE fsono = @v_salesOrder
BEGIN
OPEN c_salesOrderLineItems
FETCH NEXT FROM c_salesOrderLineItems INTO @v_salesOrderLine,
@v_endItemNumber,
@v_endItemRev,
@v_dueDate,
@v_orderQty,
@v_endItemPrice
CLOSE c_salesOrderLineItems
END