top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to Work with SUBSTRING () function in SQL Server 2008 using PL/SQL?

0 votes
261 views
How to Work with SUBSTRING () function in SQL Server 2008 using PL/SQL?
posted Mar 12, 2016 by Sathaybama

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

SUBSTRING () is the most commonly used function in the SQL Server to find the substring of a given string in other words to get some part of a string in your query.

It takes three parameters; first is the string from which the substring has to be found, second is the start position from where the substring has to start and three is the length of the substring.

In other words, function will start extracting the substring from the start position which is given and will show the substring which is till the given length next to the start position.

Syntax:

SUBSTRING(string, start_position, lengthofthesubstring)

Example:

SELECT

Result  =  SUBSTRING('test string',  6,  3) 

Output:

Substring
--------------

str

It should also be noted that SUBSTRING() function is not only used with string datatype but also for ntext, VARCHAR and CHAR datatypes

answer Mar 12, 2016 by Shivaranjini
...