troubleshooting Question

Parse Data in a SQL View

Avatar of Lawrence Salvucci
Lawrence SalvucciFlag for United States of America asked on
Microsoft SQL ServerSQL
24 Comments1 Solution94 ViewsLast Modified:
I am trying to parse data between certain characters but not sure how to go about this in a SQL view. The values I am trying to parse out are all numeric. They are wrapped in between a dash on each side. But there are also other numeric values in the data that are wrapped in between dashes so I want to make sure I grab the right section. The section I am looking to grab has 2 letters and a dash before it and then a dash after it. There are also other numeric values after the trailing dash but I don't want that section. Here are a few examples:

From this example I want to grab the 0.2487                440FSE-RD-0.2487-.0004X36
From this example I want to grab the 0.065                  TI-GR2-TU-0.065-.0020

The 2 letters before the first dash aren't always the same but it will always be just 2 letters. Then they're followed by a dash. Then the numeric portion that I want follows that dash. And then it ends with another dash and then either more numeric characters or letters after that trailing dash. So the beginning will always start with 2 letters and then a dash. And the ending will always end with a dash. So how can I write this in my SQL view to grab this section?
Join our community to see this answer!
Unlock 1 Answer and 24 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 24 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros