String functions (T-SQL) in SQL Server are as given below.
- ASCII
- CHAR
- CHARINDEX
- DIFFRENCE
- LEFT
- LEN
- LOWER
- LTRIM
- NCHAR
ASCII() : It is use to convert the number value of a specified character.
Example
CHARINDEX (char, varchar, start_index) : It is used to search specified characters into specified string from starting character index (start_index) to end of string length.
Example
DIFFRENCE (varchar, varchar) : It returns integer values. In the real world this function is usable for search operations.
Return value types:
- 0 (Zero) represents no similarity between two strings.
- 4 represents strong similarity between two strings.
- 1, 2 and 3, represents very close but not strong similarity.
Example
LEFT (varchar, length) : It is used to return string from character index 0 to length value.
Example
LEN (varchar) : It is used to return length of specified value as integer.
Example
LOWER (varchar) : It is used to convert and returns lower case value of specified value.
Example
LTRIM (varchar): It is used to remove spaces in specified value of the left.
Example
CHAR() : It is used to convert ASCII number to character value.
Example
NCHAR (char_number) : It is the same as CHAR() function but this function uses UNICODE standard.
Example