Saturday, 31 August 2013

sql get value from dynamical column

sql get value from dynamical column

I have a requirment, to select value from a dynamic column in table
select * from TempXmlData
T1 t2 t3 t4
A B C D
The T1,T2,T3,T4 columns are dynamic. I create them by xml config.
If config have five columns, this table hase five columns, if config only
has one column, this table only has one column.
Now I want to get value from TempXmlData from this table. I need to put
value together like 'A','B','C','D'. So I need to get the values from
every column, the column is unfixed.
If the Columns is fixed, I can use this way to get the value
select @Value = T1(columnName) from TempXmlData

No comments:

Post a Comment