From the course: Microsoft SQL Server 2022 Essential Training

Unlock this course with a free trial

Join today to access over 23,200 courses taught by industry experts.

Remove a table from the database

Remove a table from the database

- If you need to remove large number of records from your database, you have two different options. I currently have the script that we started earlier in the chapter that built the Red30Tech ProductCategories Table. Right now we have the create table statement that builds the table structure here at the top, and then we insert a number of records into that table. Let's take a quick peek at what the table currently looks like by coming down to the end and executing select * from ProductCategories. I'll highlight line number 17 and press execute to see those results. So the table currently contains seven rows of data. At the top of my script, I'm going to move everything down a little bit by a pressing enter a couple of times, and then moving back up to line number one. Here, I'll add a line that'll quickly remove every record from the table. This uses the truncate table command, and the table we want to truncate is…

Contents