Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 more than one value per field

Author  Topic 

Cornelius19
Starting Member

30 Posts

Posted - 2009-08-31 : 18:18:18
Hi,

I have a data file that sometimes has more than one value per field in the second column. (It was originally in Excel and the person who created it did not think of databases at all.) So, it looks like this:

quote:

1 a, b, c
2 d
3 e, f



I would like to create a new table with only one value per field that would look like this:

quote:

1 a
1 b
1 c
2 d
3 e
3 f



What would be the best way to accomplish it?

Thanks,

Cornelius

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-08-31 : 18:25:14
One way to do it:

http://www.sqlteam.com/article/parsing-csv-values-into-multiple-rows
Go to Top of Page

Cornelius19
Starting Member

30 Posts

Posted - 2009-09-01 : 18:36:25
Thanks a lot, it seems to work well.

Cornelius
Go to Top of Page
   

- Advertisement -