Converting the locator value to the LOB value

After using a locator in a Transact-SQL statement, you can convert (dereference) the locator to the corresponding LOB.

To explicitly dereference a locator, use the return_lob function. For example, to return the LOB value for @w, enter:

declare @w text_locator

select return_lob(text, @w)

You can also implicitly dereference the locator. For example, to insert the actual LOB value for @w into the textcol column of my_table, enter:

insert my_table(textcol) values (@w)

NoteThe return_lob command overrides the set sent_locator on command. return_lob always returns the LOB.

Parameter markers

You can explicitly dereference a locator when using parameter markers in Transact-SQL statements. For example:

insert my_table (textcol)) values(return_lob(text,?))

Use the locator_literal function to identify the locator:

insert my_table (imagecol) values (locator_literal(image_locator, binary_locator_value))