I am recieving an error: Unknown Token Recieved from SQL server after running this simple update below. What the update does is take 1 table holding old and new account numbers I am trying to convert, and searches another table and updates it with a new number if the account is found. There are about 2.2 million records to be converted so maybe using a cursor is ineffective? I'm not the best programmer, but this code has worked 3 other times so i'm not sure where to go from here.
Does any one have a link to information on troubleshooting this error or might know a better way of doing this?
Below is the code if you are interested:
-------------------------------------------
Declare @oldaccountnumber varchar(24),
@newaccountnumber varchar(18)
Declare mycursor2 CURSOR FOR
SELECT Original_Acct_Num, New_Num from Tmp_Update_Acct
OPEN mycursor
FETCH NEXT FROM mycursor into @oldaccountnumber, @newaccountnumber
while @@FETCH_STATUS = 0
BEGIN
Update Acct_Table
Set "ACCOUNT-NUMBER" = @newaccountnumber
Where "ACCOUNT-NUMBER" = @oldaccountnumber
FETCH NEXT FROM mycursor2 into @oldaccountnumber, @newaccountnumber
END
close mycursor
deallocate mycursor
Does any one have a link to information on troubleshooting this error or might know a better way of doing this?
Below is the code if you are interested:
-------------------------------------------
Declare @oldaccountnumber varchar(24),
@newaccountnumber varchar(18)
Declare mycursor2 CURSOR FOR
SELECT Original_Acct_Num, New_Num from Tmp_Update_Acct
OPEN mycursor
FETCH NEXT FROM mycursor into @oldaccountnumber, @newaccountnumber
while @@FETCH_STATUS = 0
BEGIN
Update Acct_Table
Set "ACCOUNT-NUMBER" = @newaccountnumber
Where "ACCOUNT-NUMBER" = @oldaccountnumber
FETCH NEXT FROM mycursor2 into @oldaccountnumber, @newaccountnumber
END
close mycursor
deallocate mycursor