OK, I am pulling a recordset at a set interval and looping thru the recordset to 1) post to salesforce and 2) to update the record to mark it as processed.
I do this a few other times for other processes using a cursor, so I just changed a few values and off it went. Minus the update. Now, when I added in the For Update I get the error that I cannot use For Update on a Read-Only cursor and here is my code.
and then
Which would beg 2 questions from me. First, could this be done more efficiently w/o a cursor (I inherited the code and hadn't thought about changing it until now) and second, why does it think it is a read-only cursor? Thanks!
WB
I do this a few other times for other processes using a cursor, so I just changed a few values and off it went. Minus the update. Now, when I added in the For Update I get the error that I cannot use For Update on a Read-Only cursor and here is my code.
Code:
DECLARE cSalesForce CURSOR
LOCAL SCROLL KEYSET
FOR
SELECT vchFirstName, vchLastName, vchEmailAddress, vchCompanyName, vchPhoneNumber, chCountryCode, chRegionCode, CustomerID, campaignid, vchproduct, vchdescription, sfga, leadsource, retURL, oid, vchSerialNumber
FROM SalesForceTempHolding WHERE posted='0'
FOR UPDATE OF posted, dtposted
OPEN cSalesForce
FETCH NEXT FROM cSalesForce INTO
...
and then
Code:
WHILE @@FETCH_STATUS = 0
BEGIN
...
UPDATE SalesForceTempHolding
set posted = '1',
dtposted = getdate()
WHERE CURRENT OF cSalesForce
Which would beg 2 questions from me. First, could this be done more efficiently w/o a cursor (I inherited the code and hadn't thought about changing it until now) and second, why does it think it is a read-only cursor? Thanks!
WB