Question

I'd like to be able to append some data to a binary field in a MS SQL 2005 server from C# without reading the original data, concatenating it, and then setting it all back.

Is this possible?

Cheers! Steve

Was it helpful?

Solution

Read about the UPDATETEXT sql statement at http://msdn.microsoft.com/en-us/library/3517w44b.aspx. The Msdn article contains example code that appends binary data to a blob in the StorePhoto method.

OTHER TIPS

I don't know if this option exists in MSSQL 2005, but if someone is searching for appending info into varbinary(max) in MSSQL2008 it can be done like this:

UPDATE [dbo].[Files] SET [FileContent].WRITE('0x',NULL,0)
WHERE Id = 1

Hope this will help someone.

Well, I don't know for a BLOB, but for text you can do this:

UPDATE tablename SET columnname=concat(columnname,' my extra text');

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top