STRING FUNCTIONS :
ASCII :
Returns the ASCII value for the specific character
| select ascii('A')
RETURNS 65 AS RESULT
```
### CHAR :
Returns the character based on the ASCII code
|
select char(65)
returns 'A' as result
| ### CHARINDEX :
Returns the position of a substring in a string
|
SELECT charindex('t',ename) from emp
| ### CONCAT :
Adds two or more strings together
|
SELECT concat(fisrtname,lastname) from radsch_orders
| ### UPPER :
Convert the text to upper-case
|
SELECT UPPER(ename) from emp
| ### LOWER :
Convert the text to lower-case
|
select LOWER(ename) from emp
| ### left :
The LEFT() function extracts a number of characters from a string (starting from left)
|
select left(ename,3) from emp
| ### RIGHT :
The RIGHT() function extracts a number of characters from a string (starting from right)
|
select right(ename,3) from emp
| ### PATINDEX :
Return the position of a pattern in a string:
|
SELECT patindex('%mi%',ename) from emp
| ### LEN :
Return the length of a string
|
Select len(eame) from emp
| ### SUBSTRING :
The SUBSTRING() function extracts some characters from a string.
|
select (columnname,startingposition,no.of charecters)
select (ename,1,5) from emp
| ### STUFF :
The STUFF() function deletes a part of a string and then inserts another part into the string, starting at a specified position.
|
select stuff(coumnname,startingposition,no.of cahrecters,replacestring)
select stuff(ename,1,3,'chi') from emp
| ### REPLACE :
The REPLACE() function replaces all occurrences of a substring within a string, with a new substring.
|
select replace(columnname,serchstring,replacestring)
select replace(ename,'smi','chi')
| ### REVERSE :
The REVERSE() function reverses a string and returns the result.
|
select reverse(columnname)
select reverse(ename) from emp
| ### REPLICATE :
The SQL REPLICATE is a SQL String Function used to repeat the existing string for a given number of times.
|
SELECT replicate(columnname,no.of times to replicate)
select replicate(columnname,2)
| ### LTRIM :
LTRIM() function helps to return remove all the space characters found on the left-hand side of the string
|
SELECT ltrim(columnname)
select ltrim(ename) from emp
| ### Rtrim :
RTRIM() function helps to return remove all the space characters found on the Right-hand side of the string
|
select rtrim(columname)
select rtrim(ename) from emp
```