Avatar of manelson05
manelson05
Flag for United States of America asked on

How do I change columnar (vertical) formatting to Horizontal

I have a large data set that I will need to use, it is currently within Excel.

I need the ability to place into a horizontal format to use in an UPDATE statement.

Currently data looks as such
                                                000019-09,
                                                000048-01,
                                                000080-01,

I need to be able to insert into SQL as follows
                                               000019-09, 000048-01,000080-01,


Thank you

Mark
Microsoft ExcelMicrosoft SQL Server

Avatar of undefined
Last Comment
Professor J

8/22/2022 - Mon
Jim Horn

What a coincidence.  Check out the article I just cranked out yesterday T-SQL:  Normalized data to a single comma delineated string and back for a SQL Server solution on how to go from normalized data to a scalar value that is multiple values separated by commas.

And yes I know the code is not easy..
manelson05

ASKER
Jim, The data I am required to use for updates within the table were hand keyed descriptions that I need to update the fields with. I'm hopeful I can convert this date from excel format then simply copy into SSMS. You article is very helpful for some procedures that I normally run here.

Mark
Jim Horn

>hand keyed descriptions that I need to update the fields with.
Not real sure what you mean by that, other than alarms are going off bigtime as users can manually enter Excel data in all sorts of ways that would eff up an automated ETL from Excel into anything normalized.

>I'm hopeful I can convert this date from excel format then simply copy into SSMS.
Especially dates, as ETL jobs will take the cosmetic rendering date and not the date itself, which is often not compatible with a database date datatype, and usually requires it be imported as a character and then 'scrubbed' to validate it's a date and then convert.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
manelson05

ASKER
Sorry Jim not sure where dates came from.

These are simple Customized fields descriptors, they are text strings only.
manelson05

ASKER
I found TRANSPOSE in excel, it places in perfect format.
Jim Horn

Correct, Excel Transpose goes from columns to rows and vice versa.  I assumed based on the commas that you were looking for a single string with values separated by commas answer.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Professor J

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.