SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual540440-003
9-70
LEFT Function
LEFT Function
The LEFT function returns the leftmost specified number of characters from a
character expression.
LEFT is an SQL/MX extension.
character-expr
specifies the source string from which to return the leftmost specified number of
characters. The source string is an SQL character value expression. The operand
is the result of evaluating character-expr. See Character Value Expressions on
page 6-37.
count
specifies the number of characters to return from character-expr. The number
count must be a value of exact numeric data type greater than or equal to 0 with a
scale of zero.
Examples of LEFT
Return 'Robert':
LEFT ('Robert John Smith', 6)
Use the LEFT function to append the company name to the job descriptions:
UPDATE persnl.job
SET jobdesc = LEFT (jobdesc, 11) ||' COMNET';
SELECT jobdesc FROM persnl.job;
Job Description
------------------
MANAGER COMNET
PRODUCTION COMNET
ASSEMBLER COMNET
SALESREP COMNET
SYSTEM ANAL COMNET
ENGINEER COMNET
PROGRAMMER COMNET
ACCOUNTANT COMNET
ADMINISTRAT COMNET
SECRETARY COMNET
--- 10 row(s) selected.
LEFT (character-expr, count)