NZSQL / Code - LEFT () function in Netezza NZ-SQL

All!

I am trying to find how to use or replace the LEFT () function for Netezza / NZSQL.

I need to grab the first two charectors of the line. The code I used in TSQL looks like this:

LEFT(COLUMN_A,2) AS Column_Name

      

is there a similar function in NZSQL? When I type "LEFT" it turns gray but is not recognized as a function and acts as if it is misisng another part ...

Thanks in advance!

+3


source to share


2 answers


You can use the built-in SUBSTR () function, or you can use the STRLEFT () function that is included in the SQL Extension Toolkit. The latter option will only be available if it has been installed.

TESTDB.ADMIN(ADMIN)=> select SUBSTR('ABCDED',1,2);
 SUBSTR
--------
 AB
(1 row)

      



or

TESTDB.ADMIN(ADMIN)=> select STRLEFT('ABCDED',2);
 STRLEFT
---------
 AB
(1 row)

      

+4


source


You can also do string right strright



select sql_functions..STRright('Value of Field',5);

      

0


source







All Articles