sql server - Populate table where columns match | TSQL -


this main table:

select name, age, race, person 

i create temp table based on available in xml file, temp table might have of fields in table person or 1 or 2 in mix order.

select * #mytemptable = mike, 44 

or can be

select * #mytemptable = race, mike 

is possible populate person table ever values have in temp table?

so if #mytemptable have column age populate person table age value column age in table person

i suggest turning xml query create temp table (sql server shred xml temp table). can have separate update statements age , race, example:

update person set age = imported.age person    inner join imported on imported.name = person.name imported.age not null 

and on.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -