Friday, 22 April 2016

Use of Left and Right function in SQL server ?

LEFT FUNCTION
Left function is used to get the left most character of the expression based on the given length

Syntax:
LEFT(CHARACTER EXPRESSION,LENGTH)

Example:
SELECT LEFT('SQL SERVER',3)

Output:
SQL
RIGHT FUNCTION
RIGHT function is used to get the right most character of the expression based on the given length

Syntax:
RIGHT(CHARACTER EXPRESSION,LENGTH)

Example:
SELECT RIGHT('SQL SERVER',6)

Output:
SERVER

No comments:

Post a Comment