SQL Server – Difference between LEFT and RIGHT function with example

SQL Server LEFT and RIGHT function fetches number character from expression, LEFT function use to fetch LEFT side value whereas RIGHT function gives value from RIGHT side of expression.

LEFT vs RIGHT function in sql server

SQL Server LEFT  function returns character and Takes two parameter, first parameter is string value or any expression and another specify the number of character to be fetch from expression. RIGHT function returns RIGHT side value

Syntax :

Input Value can be anything. Second parameter must be number that indicates number of character.


Below example will give you the idea how and when to use RIGHT and LEFT function of sql server
SELECT LEFT(‘Football’,4) as ‘Result of LEFT function’
SELECT RIGHT(‘Football’,4) as ‘Result of RIGHT function’


Result of LEFT function
Result of RIGHT function

Leave a Reply




4 + = 13