Link to home
Start Free TrialLog in
Avatar of Dale Fye
Dale FyeFlag for United States of America

asked on

instrrev() and Split() function equivalents in TSQL

Using SQL Server 2014.

I need to parse off the last two segments of a variable length string from a column in a customers database.  In Access, I would simply use either Instrrev() or the Split() functions to perform this, but would like to do it in a SQL query.

Is there an equivalent to the Access instrrev() function in TSQL, which allows you to search for the character postion from right to left in a string as in:

?instrRev("ABC DEF GHI", " ") => 8

without having to work from left to right?

How about an equivalent to the SPLIT() function which parses a string into an array based on the delimiter provided:
Arr() = SPLIT("ABC DEF GHI", " ")
yields
Arr(0) = "ABC"
Arr(1) = "DEF"
Arr(2) = "GHI"

Thanks,
Dale
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dale Fye

ASKER

Thanks, everyone.

Norie's response was easy to implement and precisely what I was looking for, (never heard of REVERSE before).  The other responses provided some other interesting techniques.