drop.sql
8 0
SqlServer 删除所有表
netnr 2018-09-21
-- 删除所有表
DECLARE @sql VARCHAR(8000);
WHILE EXISTS (SELECT name FROM sysobjects WHERE type = 'U')
BEGIN
    SELECT @sql = 'DROP TABLE ' + name
    FROM sysobjects
    WHERE (type = 'U');

    PRINT (@sql);

    EXEC (@sql);
END;
登录写评论