Wednesday, February 2, 2011

SQL Server: A Simple Method to Get Specific Part of String

SUBSTRING is a nice function to get a part of string, but when a string consists of many parts, getting specific part of it, is a bit painful task. Hopefully, following function will help you to achieve such tasks.

Hopefully, you will modify it to handle invalid sections i.e. in our example case if, only 4 section are in string but you provide if number 5 as section it will return you first part. Modify it, so it should return NULL for such cases. ;)

1 comment:

All suggestions are welcome