setdata

Description

Overwrites some or all of a large object (LOB).

Syntax

setdata(locator_name, offset_value, new_value)

Parameters

locator_name

is a locator that references the LOB value you are modifying.

offset_value

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.

new_value

is the data with which you are overwriting the old data.

Examples

Example 1

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)

Usage

Permissions

Any user can execute setdata.

See also

Commands deallocate locator, truncate lob

Transact-SQL functions locator_valid, return_lob, create_locator