Wednesday, March 28, 2012

Normalize multivalue field?

Hi,
I have a table I'm importing from access; the application that used
the table has some fields that are multivalued, separated by either
a ; or the sequence /* Ugly.
I can write a C# app to take the columns and stuff the data into my
normalized schema, but I was wondering if there was any good way to do
it in sql.
Thanks,
AndyOn Sep 7, 12:57 pm, Andy <an...@.med-associates.com> wrote:
> Hi,
> I have a table I'm importing from access; the application that used
> the table has some fields that are multivalued, separated by either
> a ; or the sequence /* Ugly.
> I can write a C# app to take the columns and stuff the data into my
> normalized schema, but I was wondering if there was any good way to do
> it in sql.
> Thanks,
> Andy
Look up Erland Sommarskog's article "arrays and Lists in SQL"|||The best approach is to clean up the data to represent one value per column.
If, by any chance, you are forced to deal with such designs, you'll have to
resort to one of the string parsing approaches. Some of them can be found
at:
www.projectdmx.com/tsql/sqlarrays.aspx
www.projectdmx.com/tsql/rowconcatenate.aspx
--
Anith

No comments:

Post a Comment