Click here to Skip to main content
15,890,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

I have data in one table that i am trying to move to another table.so i have written the cursor and fetching data and finally inserting it in to another table

What I have tried:

using cursor to update the table data
Posted
Updated 22-Apr-22 6:48am
v3

1 solution

Instead of
SQL
CASE WHEN @lstrDESCRIPTION IS NULL THEN ''NULL'' ELSE @lstrDESCRIPTION END
just use
SQL
@lstrDESCRIPTION
If the value is NULL then a NULL will be inserted.

Not sure why you are using a Cursor to do this - SQL is set based. I would have used a INSERT INTO ... SELECT ... statement.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900