Skip to content
Advertisement

Cursor is storing values in a variable but not updating in another table Sql Server

I have write a cursor in which i am getting values from a table using cursor and updating these values in another table . While testing i have analysed that values are storing in table and update is also working because sql server message shows that 1 row has been update but the values from cursor are not being update in that table I am confused and not able to get any answers

Advertisement

Answer

I’m not clear why you were having trouble, but this really doesn’t need a cursor (almost nothing does, except for a few very niche scenarios, they are slow and difficult to code).

You can just a straight joined update

You can remove the WHERE to run this on the whole table.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement