Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Working with SUBSTRING () function in SQL Server 2008 using PL/SQL.

Author: Shehzad Hemani

In this simple article you will learn that how to work with SUBSTRING () function in SQL Server using PL/SQL.

 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_positionlengthofthesubstring) 
 

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 
 

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Working with LOWER () and UPPER () function in SQL Server 2008 using PL/SQL.

Disclaimer - Privacy
© 2002-2017 DevASP.net