【问题标题】:How delete detached database on disk by T SQL?T SQL如何删除磁盘上的分离数据库?
【发布时间】:2017-12-27 05:57:50
【问题描述】:

如何使用 T-SQL 从磁盘中删除分离的数据库? 我想从我的硬盘中删除一个分离的数据库。我应该在 T-SQL 中做什么?我想创建一个同名的数据库,但在 Microsoft SQL Server 2014 Management Studio 中出现此错误:

Cannot create file 'H:...\Restaurant_Data.mdf' because it already exists. Change the file path or the file name, and retry the operation.

【问题讨论】:

    标签: sql-server tsql sql-delete delete-file detach


    【解决方案1】:

    至少有三种方式:

    1. 附加数据库并删除它
    2. 以交互方式登录服务器并从磁盘中删除文件
    3. 使用 xp_cmdshell(启用后),但不要忘记禁用它(如果不需要)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-23
      • 2015-12-18
      • 1970-01-01
      • 2016-11-30
      • 2019-09-06
      • 2021-12-09
      • 1970-01-01
      • 2021-04-20
      相关资源
      最近更新 更多