[英]HOW to create SQL Server 2017 database scripts using sqlcmd
I have a database schema sitting in SQL Server 2017 running on Ubuntu. 我有一个坐在Ubuntu上运行的SQL Server 2017中的数据库架构。 I have a separate SQL Server 2008 R2.
我有一个单独的SQL Server 2008 R2。 I need the database structure to migrate from 2017 -> 2008 R2 server and cannot find the right direction to start with.
我需要数据库结构从2017-> 2008 R2服务器迁移,并且找不到正确的方向。 I had created the backup and tried to restore but it seems we cannot restore in that fashion.
我已经创建了备份并尝试还原,但似乎我们无法以这种方式还原。 I think "create scripts" will do the job but I do not have management studio.
我认为“创建脚本”可以完成工作,但是我没有Management Studio。 All I have is
sqlcmd
running on the instance with 2017 version. 我所拥有的只是在2017版实例上运行的
sqlcmd
。 So can I run "create scripts" to get the structure of the database and store in a single .sql
file.? 因此,我可以运行“创建脚本”来获取数据库的结构并存储在单个
.sql
文件中吗?
Check this answer: How to use sqlcmd to create a database 检查此答案: 如何使用sqlcmd创建数据库
Here you go: 干得好:
sqlcmd -i C:\path\to\file.sql
More options can be found in SQL Server books online . 可以在SQL Server联机丛书中找到更多选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.