| Author |
Topic |
|
ConradK
Posting Yak Master
140 Posts |
Posted - 2010-09-15 : 15:48:34
|
| Okay, so here is the constraints of the challenge.I have table A and table B.Every row in table A must become a column in table B.Table A is thisaddmeabcdand table B is this:e,f,g,h1,1,1,1I need to update table B to reflect table A in the following waya,b,c,d,e,f,g,hnull,null,null,null,1,1,1,1See whats happening here?I have a list of 'columns' in table A that need to be added in a secondary table, that needs to be turned around and added to table B.I'm coming up with some ways on my own, but wondering what you may be thinking.Table A and B are infinitly subject to change, but for certain, the values in table A are not already a part of column B.Good Luck! |
|
|
GhantaBro
Posting Yak Master
215 Posts |
Posted - 2010-09-15 : 15:55:40
|
quote: Originally posted by ConradK Okay, so here is the constraints of the challenge.I have table A and table B.Every row in table A must become a column in table B.Table A is thisaddmeabcdand table B is this:e,f,g,h1,1,1,1I need to update table B to reflect table A in the following waya,b,c,d,e,f,g,hnull,null,null,null,1,1,1,1See whats happening here?I have a list of 'columns' in table A that need to be added in a secondary table, that needs to be turned around and added to table B.I'm coming up with some ways on my own, but wondering what you may be thinking.Table A and B are infinitly subject to change, but for certain, the values in table A are not already a part of column B.Good Luck!
You need to put the values in table in a temp table and use dynamic query to create "create table" sql and also "insert into" statements... |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2010-09-16 : 04:45:06
|
| yup. This is a crazy model. Even a key value pair model would be better than this. (and that's pretty bad most of the time).Why don't you tell us what you are actually trying to do and not how you are trying to do it?Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
|
|
|