Constraint Violating Yak Guru
Posted - 11/03/2013 : 11:06:46
| In an sql server 2008 r2 database, I have one column that I need to separate the values. I then need to concatenate the values together in one row from t-sql that looks like the following:
11-12 Midwest Plumbers 099.
The values in the column look like the following
099 11-12 Midwest Plumbers.
I need to split the data to look like
1. 099 is the Customer Number.
2. 11-12 is the year the customer data was valid.
3. Midwest Plumbers is the name of the company.
1. The delimiter between the 3 fields is " " (one space).
2. The company name can contain lots of spaces.
3. There are 3 fields that need to be separated out which are:
a. Customer Number,
b. Effective Years,
c. Customer Name.
For the one row that will be displayed there needs to be 4 spaces between each value.
Thus can can you show me how to split up the in this column and then display the values in the order the customer wants to see?