Locator scope

In general, a locator is valid for the duration of a transaction. Use the deallocate locator function to override the default scoping, and deallocate the locator within the transaction. deallocate locator can be especially useful in saving memory when you need to create many locators within a transaction. For example:

begin tran
declare @v text_locator
select @v = textcol from my_table where id=5
deallocate locator @v
...
commit

deallocate locator removes the LOB value for @v from Adaptive Server memory before the transaction commits, and marks the locator as invalid.