我知道要生成脚本,我们需要按照 Management Studio 中的步骤操作;
Right click the database
Select Tasks -> Generate Scripts
(Click next if you get the intro screen)
Select "Select specific database objects"
Pick the objects to generate scripts for (tables, stored procedures, etc...)
Click Next, then specify the output filename
This will generate the schemas only. If you want to do data generating scripts as well, click the Advanced button and scroll down to the "Types of data to script" and change it from "Schema only" to "Data only" or "Schema and data"
Click Finish to generate the script
但我不想每次都这样做,是否有任何查询或 SP 或函数来做同样的工作,因为我的工作是将远程连接到客户端并将模式获取到我的本地并完成工作,所以遵循以上步骤对我来说既乏味又耗时。如果有任何现成的脚本作品可用,那将大有帮助。