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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Truncate table variables

Author  Topic 

Rangi
Starting Member

18 Posts

Posted - 2002-12-05 : 12:36:04
Is it possible to truncate table variables?

I know that with normal tables the fastest way to delete everything in it is to truncate it (so the deletes are not logged), but I can't seem to do this with table variables. However, if transactions in table variables are not logged then presumably it is just as fast to do a delete?

Rangi

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-12-05 : 13:14:17
I don't know why you'd even need to delete rows from a table variable, but yes, you're right, DELETE would be just as fast as TRUNCATE TABLE in that instance. TRUNCATE TABLE simply deallocates data pages, it doesn't actually remove rows. Since table variables are kept in RAM, they don't have data pages.

Go to Top of Page

Rangi
Starting Member

18 Posts

Posted - 2002-12-06 : 06:16:49
Thanks very much for your advise,

Rangi

Go to Top of Page
   

- Advertisement -