Avatar of Ben Rapier
Ben Rapier
 asked on

Extract substring from field in SQL

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
Microsoft SQL ServerSQL

Avatar of undefined
Last Comment
Shaun Kline

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Shaun Kline

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck