truncatetables.sql

来自「基于微软的 ASP.NET+C#开发的PETSHOP(网上宠物店)项目,在性能及」· SQL 代码 · 共 30 行

SQL
30
字号
/******************************************************************************
**        File: TruncateTables.sql
**        Name: Benchmark Data Load
**        Desc: Remove the current data from the database in preparation
**              for the benchmark data load. If you want to restore the
**              original data, please see the DataPopulation.sql SQL script
**              (located in the Create Scripts folder).
**
**        Date: 11/6/2001
**
*******************************************************************************/

-- delete the contents of the Product table
PRINT 'Deleting Data: Product Table';
ALTER TABLE Item NOCHECK CONSTRAINT FK_Item_Product;
ALTER TABLE Product NOCHECK CONSTRAINT FK_Product_Category;
DELETE FROM Product
ALTER TABLE Product CHECK CONSTRAINT FK_Product_Category;
ALTER TABLE Item CHECK CONSTRAINT FK_Item_Product; 

-- delete the contents of the Item table
PRINT 'Deleting Data: Item Table';
ALTER TABLE Item NOCHECK CONSTRAINT FK_Item_Product;
ALTER TABLE Item NOCHECK CONSTRAINT FK_Item_Supplier;
DELETE FROM Item
ALTER TABLE Item CHECK CONSTRAINT FK_Item_Supplier;
ALTER TABLE Item CHECK CONSTRAINT FK_Item_Product;

-- delete the contents of the Inventory table
TRUNCATE TABLE Inventory

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?