Overwrites some or all of a large object (LOB).
setdata(locator_name, offset_value, new_value)
is a locator that references the LOB value you are modifying.
is a position within the LOB to which locator_name points. This is the position where the Adaptive Server begins writing the contents of new_value. The value for offset_value is in characters for text_locator and unitext_locator, and in bytes for image_locator. The first character or byte of the LOB has an offset_value of 1.
is the data with which you are overwriting the old data.
The final select statement in this example returns the string “Sybase ABC/IQ/ASA” instead of the original string, “Sybase “ASE/IQ/ASA”:
declare @v text_locator select @v = create_locator (text_locator, convert(text, "Sybase ASE/IQ/ASA") select setdata(@v, 8, "ABC") select return_lob(text, @v)
setdata modifies the LOB value in-place. That is, Adaptive Server does not copy the LOB before it is modified.
If the length of new_value is longer than the remaining length of the LOB after skipping the offset_value, Adaptive Server extends the LOB to hold the entire length of new_value.
If the sum of new_value and offset_value is shorter than the length of the LOB, Adaptive Server does not change or truncate the data at the end of the LOB.
setdata returns NULL if the offset_value is longer than the LOB value you are updating.
Any user can execute setdata.
Commands deallocate locator, truncate lob
Transact-SQL functions locator_valid, return_lob, create_locator