Large tables and indexes that use more than 128 extents are dropped in two separate phases: logical and physical. If you delete all rows in a table by using DELETE tablename or use the TRUNCATE TABLE statement, the table exists until it is dropped. If you re-create a table, you must rebind the appropriate rules and defaults, re-create any triggers, and add all required constraints. When a table is dropped, rules or defaults on the table lose their binding, and any constraints or triggers associated with the table are automatically dropped. If a table being dropped references the primary key of another table that is also being dropped, the referencing table with the foreign key must be listed before the table holding the primary key that is being referenced. Multiple tables can be dropped in any database. If both the referencing table and the table that holds the primary key are being dropped in the same DROP TABLE statement, the referencing table must be listed first. The referencing FOREIGN KEY constraint or the referencing table must first be dropped. RemarksĭROP TABLE cannot be used to drop a table that is referenced by a FOREIGN KEY constraint. Is the name of the schema to which the table belongs. Azure SQL Database does not support four-part names.Īpplies to: SQL Server ( SQL Server 2016 (13.x) through current version).Ĭonditionally drops the table only if it already exists. Is the name of the database in which the table was created.Īzure SQL Database supports the three-part name format database_name.object_name when the database_name is the current database or the database_name is tempdb and the object_name starts with #. To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.
0 Comments
Leave a Reply. |