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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-12-02 : 08:03:31
|
| Niki Sommerfeld writes "I have written a stored procedure that basically takes all information from one table and inserts it into a temp table and then transfers all of it to another table after all the updates are done. What I'm trying to do now is simplify the select statement? Right now I'm selecting about 40 fields from about 12 tables and I have 7 joins. Is it possible to put all of this into a function? I have tried to do it and I get an error, but I was just thinking maybe I'm doing something wrong. Anybody have any ideas?" |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-12-02 : 08:09:51
|
| Hi Niki Sommerfeld, Welcome to SQL Team!If you post your code we can take a look.kristen |
 |
|
|
druer
Constraint Violating Yak Guru
314 Posts |
Posted - 2005-12-02 : 08:43:48
|
| Awww c'mon Kristen. How hard could it be to solve this problem. Just make up 12 tables and 7 joins to solve the basic "takes all information from one table and inserts it into a temp table and then transfers all of it to another table". It should be perfectly understandable how taking data from 1 table and inserting into another requires 12 tables. And how hard could it be to figure out how you have 12 tables but you only need 7 joins to get the data from them. I guess you are just way to "detail oriented." :)Well maybe a little sample code from Niki might not hurt. :) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-02 : 09:03:17
|
| If you use Proper Joins then you will get Valid dataPost the Query you used and tell us the error you gotMadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-12-02 : 11:02:55
|
"Just make up 12 tables and 7 joins to solve ..."Yeah, I did that, but there were two possible outcomes, and I didn't want to be made to look a prat when I posted the wrong one as my answer Kristen |
 |
|
|
|
|
|