Saturday, 5 January 2013

UPDATE .WRITE (SQL 2012)

UPDATE .WRITE (SQL 2012)

Syntax: .WRITE ( expression, @Offset , @Length )

UPDATE table
SET column.WRITE('Inserted Text', 18, 3) 
WHERE id = 1

As per MS BOL the new .WRITE clause of the UPDATE DML statement enables partial or full updates and high performance appends to varchar(max), nvarchar(max) and varbinary(max) data type columns.

A traditional UPDATE statement is logged
Using the .WRITE clause is minimally logged (faster)

If @Offset is NULL, the update operation appends expression at the end of the column.


NB : only columns of varchar(max), nvarchar(max), or varbinary(max)  work with UPDATE.WRITE
 
Links :
UPDATE statement with new .WRITE Clause
0201-SQL Server-UPDATE statement-use .WRITE for partial updates

No comments: