Questions tagged «sp-msforeachtable»

15
如何删除SQL Server数据库中的所有表?
我正在尝试编写一个脚本,该脚本将完全清空SQL Server数据库。这是我到目前为止的内容: USE [dbname] GO EXEC sp_msforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT all' EXEC sp_msforeachtable 'DELETE ?' 在Management Studio中运行它时,我得到: 命令已成功完成。 但是当我刷新表格列表时,它们仍然存在。我究竟做错了什么?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.