Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » SQL Anywhere Server - SQL Reference » Using SQL » SQL functions » Alphabetical list of functions

 

LEFT function [String]

Returns a number of characters from the beginning of a string.

Syntax
LEFT( string-expression, integer-expression )
Parameters
  • string-expression   The string.

  • integer-expression   The number of characters to return.

Remarks

If the string contains multibyte characters, and the proper collation is being used, the number of bytes returned may be greater than the specified number of characters.

You can specify an integer-expression that is larger than the value in the column. In this case, the entire value is returned.

This function supports NCHAR inputs and/or outputs. Whenever possible, if the input string uses character length semantics the return value will be described in terms of character length semantics.

See also
Standards and compatibility
  • SQL/2003   Vendor extension.

Example

The following statement returns the first 5 characters of each Surname value in the Customers table.

SELECT LEFT( Surname, 5) FROM Customers;