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-02-26 : 07:42:47
|
| David Geuss writes "I was recently asked which would be quicker. Assume the table has a few thousand records.1) Drop a temp table.2) Truncate a temp table.Thanks,Dave" |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-02-26 : 07:59:42
|
| Truncate has the advantage in terms of speed....(non-logged operation)However it brings its own problems....authorisation level required to execute same, not suitable for tables involved as parent in parent-child relationships, amongst otherssearch here for TRUNCATE and DELETE and you'll come across this discussion before. |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-02-26 : 08:28:49
|
| For a temp table, the truncate should be fine though. The drop will incur more cost, especially if you are reusing the temp table in the same stored procedure. I would assume this would be the only reason you would even ask the question involving temp tables.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-02-26 : 09:51:04
|
| I can't imagine how this would have any practical implications. Truncate and Drop are different, not two ways to accomplish the same goal.Jay White{0} |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-02-26 : 12:44:59
|
| I wonder if the poster meant delete vs. truncate. As Jay pointed out, truncate and drop are different so no comparisons to make. But delete and truncate are similar.Tara |
 |
|
|
|
|
|