How do I update a BLOB field only using TSQL (for example from SSMS and not using any code such as ADO.Net or Linq)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are two ways to SELECT a BLOB with TSQL:
As well as:
Note the correlation name after the FROM clause, which is mandatory.
The second version can be used for a UPDATE as in the following example:
For partial updates one can use the SET .WRITE mutator as described in this MSDN article, here is the syntax:
Note that the WRITE mutator can only be used on NON-NULL fields.
In fact this can also be used to do a full update (if the column does not contain NULL), by setting @offset to 0 and @length to NULL (or to the actual length), as in the following example: