5

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
  • 1
    varbinary(max) or image ? it matters Commented Nov 19, 2012 at 8:04

1 Answer 1

8

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.