We help IT Professionals succeed at work.
Get Started

SQL Query parsing one field into many

Last Modified: 2012-05-12
We have a sql server database that stores a multiline customer address in a single field. I found out that a carriage return is what separates each line.

Here is an example of data

123 Main StApt 1Some City, MyState 12345

The address shows up in our erp as
123 Main St
Apt 1
Some City, MyState 12345

What I want to extract are the two address lines in a SQL query:
123 Main St as address1
Apt 1 as address2

Any suggestions? Thanks!
Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE