Tuesday, 29 March 2016

Use of SUBSTRING Function in SQL Server

SUBSTRING function is used to select the Part of the String in a Expression 

Syntax : 

SUBSTRING('STRING EXPRESSION','START','LENGTH')

Example :

SELECT SUBSTRING('JK SQL SEVER BLOG',4,20)

Output :

SQL SERVER BLOG

In above example ,the substring function will select the string from 4th character to 20th character.
Using this function we can select the required part of the string in a expression.

3 comments: