We help IT Professionals succeed at work.

Storing values until ready to write to table - best way to do it

Using stored procedures to calculate - data has about 15 records all related to one test - each having tehir own set of calculated results.  We hav to loop through them - Debating right now what would be the best way to stor this data - write each calculation into a temporary table, wait until the whole row of calculations are done and then write to final table, cursors (although I don't think that'd be a good idea) just use variables - an array doens't meet our needs.  A hash table woudl but is their an equivalent in stored procedures??
Comment
Watch Question

Database Consultant
CERTIFIED EXPERT
Top Expert 2009
Commented:
>write each calculation into a temporary table, wait until the whole row of calculations are done and then write to final table
This is a better option and even better option will be the one which replaces the temp table with a table variable

Author

Commented:

What is a table variable?  
AneeshDatabase Consultant
CERTIFIED EXPERT
Top Expert 2009

Commented:
table variable is similat to TempTable , you can use it as u use a temp table;also it has some performance gain over temp tables if you deal with less no of records


declare @Tab Table( i int, name varchar(100) )

Author

Commented:

Can you supply me with a link on MSDN - I cannot find it ..
AneeshDatabase Consultant
CERTIFIED EXPERT
Top Expert 2009

Commented:

Explore More ContentExplore courses, solutions, and other research materials related to this topic.