简体   繁体   English

如何将本地Visual Studio MDF数据库导出为Azure SQL数据库的格式

[英]How to export local Visual Studio mdf database to format for Azure SQL database

I have been creating an application in visual studio using a local database in a .mdf (SQL Server) database file. 我一直在Visual Studio中使用.mdf (SQL Server)数据库文件中的本地数据库创建应用程序。 Recently, I created an Azure account and want to export the local database (with its structure and data) so that I can use it from Azure to allow for online connections. 最近,我创建了一个Azure帐户,并希望导出本地数据库(及其结构和数据),以便可以从Azure使用它来进行联机连接。 Visual Studio doesn't seem to export the create scripts for the tables (including the table data). Visual Studio似乎没有导出表(包括表数据)的创建脚本。 Really strange how there's no standard way of achieving this. 真的很奇怪,没有实现这一目标的标准方法。 Visual Studio should have a database exporting tool. Visual Studio应该具有数据库导出工具。

You can export the database as a BACPAC file, which includes both schema and data, and then import into Azure SQL Database. 您可以将数据库导出为包含架构和数据的BACPAC文件,然后导入到Azure SQL数据库中。 This can be done from the SSMS GUI, sqlpackage.exe CLI, or PowerShell. 这可以从SSMS GUI,sqlpackage.exe CLI或PowerShell中完成。 See these steps to export a database . 请参阅以下步骤导出数据库 The BACPAC can be similarly imported into your Azure SQL Database. BACPAC可以类似地导入到您的Azure SQL数据库中。

Another method is the Data Migration Assistant . 另一种方法是数据迁移助手 See this MDA walkthrough . 请参阅此MDA演练 That tool also checks for compatibility issues during the process. 该工具还会在此过程中检查兼容性问题。 Remember that to connect to a local database managed by Microsoft SQL Server, the name of the local server will be akin to: "(localdb)\\V13.0". 请记住,要连接到由Microsoft SQL Server管理的本地数据库,本地服务器的名称应类似于:“(localdb)\\ V13.0”。 You will have to change the "V13.0" part to match the SQL Server version you are running. 您将必须更改“ V13.0”部分以匹配您正在运行的SQL Server版本。 V13.0 Corresponds to Microsoft SQL Server 2017. V13.0对应于Microsoft SQL Server 2017。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C#Visual Studio本地数据库路径异常(.mdf) - C# Visual Studio local database path exception (.mdf) 如何在Visual Studio中添加SQL Server数据库文件(.mdf)而不安装SQL Server Express Edition? - How to add SQL Server database file (.mdf) in Visual Studio without installing SQL Server Express Edition? 如何使用本地 mdf 文件在 Visual Studio 中建立 SQL 连接 - How to establish SQL Connection in Visual Studio using local mdf file 如何在 Visual Studio 2012 中访问已发布的 .mdf 数据库文件 - How to access published .mdf database file in Visual Studio 2012 将SQL Azure数据库导出到本地计算机 - Export SQL Azure database to local machine 停止Visual Studio将数据库MDF复制到bin - Stop Visual Studio Copying Database MDF to bin 将Sql Compact数据库的数据(mdf文件)导出为Access或Excel或CSV格式 - Export Data of Sql Compact database (mdf File) to Access or Excel or CSV format 使用 Visual Studio Code 连接 Azure SQL 数据库 - Connecting an Azure SQL Database with Visual Studio Code 如何在Visual Studio 2012中导出数据库架构? - How to export database schema in Visual Studio 2012? Visual Studio 2019 从 Azure 数据库导出结果失败 - Visual Studio 2019 Export result from Azure Database failed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM