Online Training for Asp.net MVC Web Designing Development, MS SQL, Digital Marketing

SQL Drop Table Statement Example


Here you learn how to drop a table in SQL Server.

Remember that once you drop a table all data in that table will be lost, so be careful before executing Drop statement in SQL Server.

Drop is like you are deleting the object permanently from SQL Server, but in SQL Delete is considered as query statement.

So , here is how you can Drop a table.
// drop TABLE [schemaName].[tableName]

drop TABLE [dbo].[tbTeacher]

If you want to just delete the data , think of delete or truncate but don’t drop the table.

Exception:
If the table is referenced by FOREIGN KEY Constraint, then it will not allow you to drop the table, and throw an exception "Could not drop object 'table' because it is referenced by a FOREIGN KEY constraint"


Comment
Name Email Website
Subscribe
 
Drop Table Example in SQL Database

Group Training