使用什么打开 .mdf(SQL 数据库)文件

2021-09-23 00:00:00 sql-server webmatrix

我希望能够打开 .mdf 文件.我正在使用 WebMatrix,我可以在那里查看查询.我也可以阅读架构.但是如何在不使用 WebMatrix 的情况下读取文件.它的 SQL Server 文件不是 Compact 版本.

I was hoping to be able to open .mdf file. I am using WebMatrix, I can view the queries there. I can read the schema too. But how can I read the file without using WebMatrix. Its SQL Server file not the Comptact edition.

我搜索了网络帮助(通过窗口).但一切都是徒劳的.我更喜欢任何链接或任何方法来阅读基本查询.

I have searched for web help (Through windows). But all in vain. I will prefer any link or any method to read the basic queries.

推荐答案

.sdf 实际上是一个 Compact Database 文件(除非您更改了会出现问题的扩展名).SQL Server 将是 .mdf.

.sdf is, in fact, a Compact Database file (unless you've changed the extension which would be problematic). SQL Server would be .mdf.

您可以将数据库附加到您的本地 SQLEXPRESS 实例并查看它.可以在 msdn 上找到附加它的示例:如何:将数据库文件附加到 SQL Server Express.基本上你是在打电话:

You can attach the database to your local SQLEXPRESS instance and view it. An example of attaching it can be found on msdn: How to: attach a Database File to SQL Server Express. Essentially you're calling:

USE [master]
GO

CREATE DATABASE [database_name] ON 
    ( FILENAME = N'C:\Path\To\<database name>.mdf' ),
    ( FILENAME = N'C:\Path\To\<database name>.ldf' )
    FOR ATTACH ;
GO

SQL 精简版 (.sdf)

我发现打开它们的最佳工具是 CompactView.

相关文章