7

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

"Update scripts generated successfully"

However, I am unable to see the generated script. Any idea where this went or if it failed?

enter image description here

d219
  • 2,707
  • 5
  • 31
  • 36
Steve Coleman
  • 1,987
  • 2
  • 17
  • 28
  • Visual Studio Schema Compare tool creates update script in %TEMP% folder. Try to search file with name %TEMP%\LQDB_State_Update1.publish.sql. Number in file name is autoincremented – Dmitry Kolchev Jun 22 '18 at 11:27
  • Sadly, i had looked there and cannot find anything. – Steve Coleman Jun 22 '18 at 14:42
  • may be a problem that there is no difference in the schemas and visual studio does not really generate script in this case – Dmitry Kolchev Jun 22 '18 at 14:45
  • Its showing many differences in the pane. Not sure what to do about it. – Steve Coleman Jun 22 '18 at 16:04
  • what version of SQL Server Developer Tools do you have? It may be has sense to install the latest version of SSDT from https://learn.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017#ssdt-for-vs-2017-standalone-installer – Dmitry Kolchev Jun 22 '18 at 17:10

3 Answers3

11

According to this page "The generated script appears in a new Transact-SQL Editor window".

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").

7

I've noticed that if SSMS is running , SSDT won't generate Schema Compare script. As soon as I close SSMS and try to generate script again SSDT creates one successfully.

user1508840
  • 81
  • 2
  • 3
0

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
  2. Right Click on database name
  3. Select Extract Data Tier Application
  4. select location for file save
  5. select Schema Only
  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