Inserting and updating text variables
This topic contains some additional information for when an
INSERT or
UPDATE statement includes text variables.
Including single quotes in the text
To insert or update a text variable with a string that contains single quotes, escape each single quote with another single quote. For example:
UPDATE vdata SET display_name = 'Jonathan ''Jon'' Smith'
WHERE respondent.serial = 1001
The updated variable looks like this:
respondent.serial display_name
================= ====================
1001 Jonathan 'Jon' Smith
Including linefeeds in the text
To insert or update a text variable with a string that should contain a linefeed, use the
ChrW to include the linefeed character (ASCII code 10). For example:
UPDATE vdata SET other_cities_visited =
'Amsterdam' + ChrW(10) + 'Tokyo' + ChrW(10) + 'Cairo'
WHERE respondent.serial = 77
The updated variable looks like this:
respondent.serial other_cities_visited
================= ====================
77 Amsterdam
Tokyo
Cairo
See also