troubleshooting Question

Extract substring from field in SQL

Avatar of Ben Rapier
Ben Rapier asked on
Microsoft SQL ServerSQL
1 Comment1 Solution142 ViewsLast Modified:
Using a SELECT query if possible, I need to "extract" a substring from within a field from a SQL db table. For example, I have a summary field in the 'Service' table [dbo.Service.summary] that contains a lot of unnecessary data but somewhere in all of that data is a substring that begins with 'INC' such as 'INC1256559'. How do I select only the substring (beginning with 'INC' and ending with the following space minus 1 [' ' -1]? Of course, I want to give the resulting column an alias like AS 'INC Number'

Full Example: T0554 Incident INC1256559 - DSL possible damaged cable run need tech to replace patch and phone cable
Shaun Kline
Lead Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
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 1 Comment.
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