I have binary data in specific field in sql server 2008, but i want to append some binary data to the same field. can you help me about that?
1 Answer
If it is a varbinary(n) / varbinary(max) - you just append with +:
declare @foo table(id int, bar varbinary(max))
insert @foo values(1, 0x01)
declare @newdata varbinary(max) = 0x020304
update @foo set bar = bar + @newdata
where id = 1
select bar from @foo
where id = 1
If you are using image, you can use UPDATETEXT, but it is more involved (read MSDN) - insert_offset of NULL means "append", and specify delete_length of 0.
varbinary(max)orimage? it matters