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 - 2004-12-07 : 08:39:12
|
| malamoh@hotmail.com writes "Hi,I use lot of temp tables in my procedure to avoid cursors. But I know it is better to use TABLE data type rather than creating too many temp tables. But I am not getting proper examples on books online . Can you please give me some example about TABLE data type.And also in most of the case we will be adding fields to temp table dynamically. Say temp table will be having on columns col1 and col2. Based on some criteria we may add col3 and col4 also. Is this possible with this TABLE data type ?Bye,Mala" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-12-07 : 09:28:10
|
| >> But I know it is better to use TABLE data type rather than creating too many temp tables.Not necessarily. They are p[robably faster for small amounts of data but temp tables can be better and more flexible for large amounts.Have a look at table variables in bol they are quite simple.declare @t table (i int)Try it and see.Also see http://www.nigelrivett.net/AccessTempTablesAcrossSPs.htmlFor considerations about changing structures and accessing them.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|