Explicitly creates a locator for a specified LOB then returns the locator.
The locator created by create_locator is valid only for the duration of the transaction containing the query that used create_locator. If no transaction was started, then the locator is valid only until the query containing the create_locator completes execution
create_locator (datatype, lob_expression)
is the datatype of the LOB locator. Valid values are:
text_locator
unitext_locator
image_locator
is a LOB value of datatype text, unitext, or image.
Creates a text locator from a simple text expression:
select create_locator(text_locator, convert (text, "abc"))
Creates a local variable @v of type text_locator, and then creates a locator using @v as a handle to the LOB stored in the textcol column of my_table.
declare @v text_locator select @v = create_locator(text_locator, textcol) from my_table where id=10
Any user can execute create_locator.
Commands deallocate locator, truncate lob
Transact-SQL functions locator_literal, locator_valid, return_lob