Substring function, as the name suggests, is used to get a sub-string from a string. A sub-string is some part of a string. Mostly, when talking about sub-strings, we mean non-empty sub-strings.
Substring is an important string manpulation function and is invariably a part of any programming environment.
General syntax for obtaining a sub-string is
substring(string, startingindex, length)
A sample code for substring in T-SQL is :
select substring(custName,1,5) from tab_Customer
1 is starting location and 5 is the length of the substring to be obtained. So we are trying to obtain a substring of first 5 letters of all customer names
|
No responses found. Be the first to respond and make money from revenue sharing program.
|