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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 update image column data

Author  Topic 

dev45
Yak Posting Veteran

54 Posts

Posted - 2004-10-01 : 02:25:34
hello
i have 1 table which have an image column
Table1 (id1 int, imCol1 image)

i want to update the contents of a record with the ones of another record
this is what i do :

EXEC sp_dboption 'dbName, 'select into/bulkcopy', 'true'
DECLARE @ptrvalSource binary(16),@ptrvalTarget binary(16)

SELECT @ptrvalSource = TEXTPTR(imCol1)
FROM Table1
Where id= 1

SELECT @ptrvalTarget = TEXTPTR(imCol1)
FROM Table1
Where id = 2

WRITETEXT Table1.imCol1 @ptrvalTarget @ptrvalSource

if imCol1 = 0x31 where id= 1 , why after the update
imCol1 = 0xF7FFDD3D000000002401000001000500
where id =2 ?

shouldn't it be 0x31 as well ?

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-10-01 : 03:15:04
wouldn't be better and easier to manage if you just save the path of the image instead of saving the image in your database?

just a thought...
Go to Top of Page

dev45
Yak Posting Veteran

54 Posts

Posted - 2004-10-01 : 03:39:44
it is an image datatype column
it stores entire word documents ...
and it is the clients will not to keep the file on the disc (on a hard disk folder) but instead use the db....
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-10-01 : 05:06:21
Because of the problems you are encoutering with this datatype (and this is only the beginning!!!)....this advice definitely applies....search here for more detailed arguements in favour of keeping images out of SQL....even if the client thinks it's a neat idea....not every invention/feature from M$ is worth the investment!!!!

"wouldn't be better and easier to manage if you just save the path of the image instead of saving the image in your database?"
Go to Top of Page
   

- Advertisement -