Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
learntsql
524 Posts |
Posted - 2010-07-09 : 06:38:09
|
| I have written a query which has around 60 lines of Code.And this 60 line of code must be executed agianst around 60 table that means everytime only tableName will be changed.Now my query is should i write 60*60=3600 lines of code or should i build a dynamic SQL with while loop and where i pass the table names.Which one is preferable as per performance and other issues? TIA. |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2010-07-09 : 06:41:29
|
| This is impossible to answer without knowing some more details. Can you post some examples of what you need to do?- LumbagoMy blog (yes, I have a blog now! just not that much content yet) -> www.thefirstsql.com |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-07-09 : 06:42:46
|
| Is it a one time job?You can use a dynamic sql. Make sure you read this fully www.sommarskog.se/dynamic_sql.htmlMadhivananFailing to plan is Planning to fail |
 |
|
|
learntsql
524 Posts |
Posted - 2010-07-09 : 06:45:37
|
| This i make as SQL Job and runs daily once or twice. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-07-09 : 06:48:51
|
| Are 60 tables names fixed?MadhivananFailing to plan is Planning to fail |
 |
|
|
learntsql
524 Posts |
Posted - 2010-07-09 : 06:52:01
|
| Yes they are fixed and i am maintaining these table name in some other table including its description. |
 |
|
|
|
|
|