简体   繁体   English

Visual Studio 架构比较找不到生成的脚本

[英]Visual Studio schema compare can't find generated script

I am performing SQL Server schema comparison using Visual Studio 2017. I am pressing on "Generate script" button of Schema Compare utility and see the message我正在使用 Visual Studio 2017 执行 SQL 服务器架构比较。我按下架构比较实用程序的“生成脚本”按钮并看到消息

"Update scripts generated successfully" “更新脚本生成成功”

However, I am unable to see the generated script.但是,我看不到生成的脚本。 Any idea where this went or if it failed?知道这是怎么回事还是失败了?

在此处输入图像描述

According to this page "The generated script appears in a new Transact-SQL Editor window". 根据此页面, “生成的脚本将出现在新的Transact-SQL编辑器窗口中”。

When this didn't work for me, i closed all open windows other than the schema compare window and re-checkmarked all differences in the list (i had un-checked some). 当这对我不起作用时,我关闭了除架构比较窗口以外的所有打开的窗口,并重新选中了列表中的所有差异(我未选中其中的一些)。 After doing this and running "Generate Script" again, Visual Studio did actually open a new window with the script (The filename was "C:\\Users\\me\\AppData\\Local\\Temp\\MyDbName_Update1.publish.sql"). 执行完此操作并再次运行“生成脚本”后,Visual Studio确实使用该脚本打开了一个新窗口(文件名为“ C:\\ Users \\ me \\ AppData \\ Local \\ Temp \\ MyDbName_Update1.publish.sql”)。

I've noticed that if SSMS is running , SSDT won't generate Schema Compare script. 我注意到,如果SSMS正在运行,SSDT将不会生成模式比较脚本。 As soon as I close SSMS and try to generate script again SSDT creates one successfully. 一旦我关闭SSMS并尝试再次生成脚本,SSDT将成功创建一个脚本。

Instead of direct compare from connection string, generate schema file and then compare that file不是直接比较连接字符串,而是生成模式文件然后比较该文件

do this steps:执行以下步骤:

  1. in visual Studio Go To Sql Server Object Explorer在 Visual Studio Go 到Sql 服务器 Object Explorer
  2. Right Click on database name右键单击数据库名称
  3. Select Extract Data Tier Application Select提取数据层应用
  4. select location for file save select 文件保存位置
  5. select Schema Only select仅模式
  6. deselct all checkbox option or check as your compare requirement取消选择所有复选框选项或检查您的比较要求

do the same for both source database and target database对源数据库和目标数据库做同样的事情

then然后

when compare schema select option Data-Tier appication file option当比较模式 select 选项数据层应用程序文件选项

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM