Active Server - When You're Done With A Temporary Table, Just Dump It!

We're sure this next tip will make most DB administrators cringe and scramble to revoke their user's permissions. To delete a SQL Server table, you simply need to execute a query using the Drop keyword and the table name you want to destroy, like so:

  • DROP Table tablename

We were also able to perform the task in our ASP code by passing the SQL statement to an open connection, as shown here:

  • result = cn.Execute("Drop Table tablename")

If the operation is successful, SQL Server will return a result of True. We'll try to be responsible and specify that you should only perform this operation on temporary database tables that you created and you should back up your database first to prevent a typo from sending you to the unemployment line.

Go back