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 |
|
Vishakha
Starting Member
40 Posts |
Posted - 2006-06-01 : 06:52:06
|
| It may be a very basic question, let me split it in 2 parts1. My stored procedure has one temp table, I want to do some computation and create another table and put those values in that tablethis is what i am doinginsert into table2select col1, col2, col3from table 1where col1, col2 and col3 are computed values based on the values in the table 1.How is this insert taking place, is it the batch mode, is there any more efficient way of doing this.since the insert is based on the id field, is it possible to alter create the new columns in the table1, do the computation on the table 1 and insert the new field.How will this approach work in terms of performance, please help |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-01 : 07:00:57
|
| What type of computation?Do you want to do something like this?insert into table2(col1,col2,col3)Select col1*34,col2,col1*10 -- or some other caluculationsfrom table1MadhivananFailing to plan is Planning to fail |
 |
|
|
Vishakha
Starting Member
40 Posts |
Posted - 2006-06-01 : 09:01:41
|
| No I am doing computation like sum [col1_data], for all the users based on the uid. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-01 : 09:59:47
|
| Do you want to copy the sums to other table?Why cant you do this in select statement?Select cols, sum(col) from...group by colsMadhivananFailing to plan is Planning to fail |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-06-01 : 10:09:12
|
| Vishakha,Please post some sample data & how do u want those to be inserted into the 2nd table (ie. expected results)Srinika |
 |
|
|
|
|
|
|
|