SubStr SQL Function to get sub string
The SubStr(String Or Value , Start Position , [ Length ]) function takes either two or three parameters and returns the substring. It works with all datatypes,
null will return NULL start position and length should be within string length or first parameter length.
SELECT SubStr('SQLDatabase.Net', 4) /* returns : "Database.Net" start returning from 4th character */;
SELECT SubStr('SQLDatabase.Net', 4, 8) /* returns : "Database" start returning from 4th character till 8th character */;
SELECT SubStr(1234567890, 4) /* returns : "4567890" */;
SELECT SubStr(1234567890, 4, 4) /* returns : "4567" */;
SubStr can limit the number of characters from the start or end of the string and can return sub string of a string, similar to .NET SubString() function. It works similar to Visual Basic Mid function.