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 |
|
BitShift
Yak Posting Veteran
98 Posts |
Posted - 2007-03-27 : 10:20:09
|
| If you do something like:declare @fred char(10)select @fred = (select top 1 fieldhere from some table where ... order by ... desc)Does this use the temp db ? |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-03-27 : 10:22:15
|
| It might use tempdb to do the order by unless it can use an index for it.==========================================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. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-27 : 10:23:02
|
| Why not select top 1 @fred = fieldhere from some table where ... order by ... descPeter LarssonHelsingborg, Sweden |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2007-03-27 : 15:10:25
|
quote: Originally posted by X002548 I think the answer is it would most likely use memory...table variables use memory
If they are small enough to be held in memory. ;) |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-03-27 : 16:10:24
|
| AFAIK, TOP/ORDER BY definetely uses tempdb to do the sort.************************Life is short. Enjoy it.************************ |
 |
|
|
|
|
|