sql server - Semantics of .WRITE(NULL, NULL, NULL) when updating a VARBINARY(max) column -


what semantics of following query

update table set column .write(null, null, null) 

if column of varbinary(max) type , contents not null?

a quick test suggests query no-op:

--drop table [table] create table [table] ([column] varbinary(max)) insert [table] values (0x12345678) update [table] set [column] .write(null, null, null) select * [table] 

executing not alter data in column. however, can't seem find evidence in documentation. have overlooked something, or no-op behavior change?

actually careful reading of doc linked (here) logically implies .write(null,null,null) should try truncate column length is. i.e., no-op.

note italicized sections in extract doc:

.write (expression,@offset,@length):

specifies section of value of column_name modified. expression replaces @length units starting @offset of column_name. ...

expression: value copied column_name. ... if expression set null, @length ignored, , value in column_name truncated @ specified @offset.

@offset: starting point in value of column_name @ expression written. ... if @offset null, update operation appends expression @ end of existing column_name value , @length ignored. ...

so if @offset null, treated though current length of column.

and, if expression null, column truncated @ @offset value.

ergo, if both null, column truncated @ current length. take mean nothing.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -