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)?
相关问题
- Views base64 encoded blob in HTML with PHP
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- What is the best way to cache a table from a (SQL)
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: