Sql substring function

December 21 22:49 2010

 imageSubstring function in sql server extracts a portion of a string, this function troubled me in a couple of times with lack of awareness in string indexes

 

 

 

Now i cleared the ambiquity and so posting here

Syntax

Select substring(stringth, start, length)

Here

String = the main string

Start = from where extraction should start

Length = the total length from 0 th character of the string of main string

Eg.

If we want to extract .’ef’ from ‘abcdef’

The select statement should be like

Select substring(‘abcdef’,5,6)

Ie. Extraction will start from the very start character to the very end

  Categories:
view more articles

About Article Author

abhilash
abhilash

a gadget and internet addict , a red hat certified linux administrator with skills in dataware development and online technologies., follow me on twitter @abhilashsnair

View More Articles