Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS SQL Server 2014 2

Status
Not open for further replies.

jchewsmith

Technical User
Nov 20, 2006
161
US
I have a field in a table that contains various info based on customer. I want to extract a portion of the field into a new column in a view based on a name in the field.

Example my column "option" contains the following info:

product, widget; name,'Jones; address, 123 main; date, 1/1/2016; sex, male' age, 50;

I want my new column to only pull all information after name and before age?



 
If the data is always formatted the same. You might be able to do a fairly complex mid statement (Experts, maybe you have a better solution).

mid ({option}, instr({option}, ' name,')+6, instr({option}, ' age,')-1)
 
You could also do something like this:

Split({Option Field}, "'", 2)

This will only work if the name information is the only thing that's quote-delimited. If there's anything before that which has single quotes around it, the formula will be more complex.

-Dell

DecisionFirst Technologies - Seven-time SAP BusinessObjects Solution Partner of the Year
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top