I need to copy a value of an image column from one row to another. I tried to use variables for that, but I can’t even declare that type of variable. SQL Server returned this error message:
Msg 2739, Level 16, State 1, Line 1
The text, ntext, and image data types are invalid for local variables.
Well the
imagedata type has been deprecated, so you should be changing your tables and all of your code to usevarbinary(max)(you will have to do this at some point, the sooner the better). An easy workaround in the meantime would be to usevarbinary(max)in your variable:However if you are performing an update, why do you need to use an intermediate variable in the first place? You can join two rows in the same table quite easily…
Sample:
Results: