Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi,In my table I have one column of type Image. I want to copy image from one row to another.I'm using WRITETEXT and READTEXT. Following is the code for it but it's not working..pls help me out...DECLARE @srcPtrVal binary(16)SELECT @srcPtrVal = TEXTPTR(COL_Image) FROM Table1 WHERE id = 3DECLARE @DestPtrVal binary(16)SELECT @DestPtrVal = TEXTPTR(COL_Image) FROM Table1 WHERE id = 6WRITETEXT Table1.COL_Image @DestPtrVal (READTEXT SMP_Catalogue_Item.SMP_CI_Image @srcPtrVal 100) Vijay
SwePeso
Patron Saint of Lost Yaks
30421 Posts
Posted - 2007-09-25 : 06:05:23
I suppose normalUPDATE t1SET t1.Col_Image = (SELECT t6.Col_Image FROM Table1 AS t6 WHERE t6.ID = 6)FROM Table1 AS t1WHERE t1.ID = 3doesn't work for you?E 12°55'05.25"N 56°04'39.16"
vijaykumarjoshi
Starting Member
2 Posts
Posted - 2007-09-25 : 10:16:19
No. Normal update doesn't work for text, ntext and image data types.
SwePeso
Patron Saint of Lost Yaks
30421 Posts
Posted - 2007-09-25 : 10:29:36
Very strange. Are you really sure?
CREATE TABLE #Temp ( ID INT, Data IMAGE )select * from #tempINSERT #TempSELECT 1, 0x1234 UNION ALLSELECT 6, 0x2244select * from #tempUPDATE t1SET t1.Data = (SELECT t2.Data FROM #Temp AS t2 WHERE t2.ID = 6)FROM #Temp AS t1WHERE t1.ID = 1select * from #tempdrop table #temp