SQL String Functions in SAP HANA with Examples and syntax

SQL String Functions in SAP HANA with Examples and syntax:-

The SQL string Function in SAP HANA contains something different then the SQL SERVER.Below all the SQL functions are explained one by one with examples and with syntax.

1.ASCII(‘character_value’) or ASCII(number): functions returns the ASCII value of the first character in the input

2.BINTOSTR(‘encoded_value’): function converts VARBINARY string binary string into character string using CESU-8 encoding. This will be useful when we want to do any data encoding in Data Warehouse system

[AdSense-A]

3.CHAR(ASCII_VALUE): This is used to get character value for the ASCII value.

4.CONCAT(string1,string2): This is used to concatenate more than one string values.

5.INSTR(string,search_string): This function returns the position of the specified string in the input string.

6.LCASE(‘string’): This converts the given input characters into lower case.

[AdSense-A]

7. LEFT(‘string’,n): This returns the number of characters/bytes specified from the left side in the input string.

8.LENGTH(string): This gives the length of the given string as the number. The starting number is always 1.

9. LOCATE(string, substring): This gives the starting position of the specified substring in a given input string

10.LOWER(string): This converts all the characters in the given string to lower case. This is same as LCASE function.

11.LPAD(string, length, pattern): This function is used to do padding on the left side for the given input string. If the pattern is not specified, then it places spaces or it uses the specified pattern for padding.

[AdSense-A]

12.LTRIM(string,remove_pattern): Thus function removes all the leading spaces in the given input string. If the specific pattern is mentioned then it removes that pattern from the input string.

11. NCHAR(number): This function returns the UNICODE character for the given input number.

12.REPLACE(string,search_string,replace_string): This function can be used to replace specific string pattern with different one in the input string.

13. RIGHT(string,number): This function returns the number of characters in input string from the right based on the specified number.

[AdSense-A]

14. RPAD(string, length, pattern): This function is used to do padding on the right side for the given input string. If the pattern is not specified, then it places spaces or it uses the specified pattern for padding.

15. RTRIM(string,remove_pattern):  Thus function removes all the trailing spaces in the given input string. If the specific pattern is mentioned then it removes that pattern from the input string.

16. STRTOBIN(string, codepage) : This function converts all the characters in the input string into a binary encoding with defined codepage.