February 16th, 2012, 04:25 PM
Join Date: Nov 2007
Time spent in forums: 1 h 15 m 10 sec
Reputation Power: 0
Best way to convert name/value to columns?
I have a poorly designed database which has name/value pairs
name | value
I'm trying to convert it into a proper table with SQL
IPAddress | Submask | ...
So far the only way I found was to run subselects over and over for each string. EX
(select value from table1 where name = 'IPAddress' ) as IPAddress,
(select value from table1 where name = 'Submask' ) as Submask
I've looked into case statements but ends up with blanks (one record for each attribute).
Any help is appreciated.