Visual Studio schema compare can't find generated script
Asked Answered
O

3

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

Okwu answered 21/6, 2018 at 23:32 Comment(5)
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 autoincrementedCooee
Sadly, i had looked there and cannot find anything.Okwu
may be a problem that there is no difference in the schemas and visual studio does not really generate script in this caseCooee
Its showing many differences in the pane. Not sure what to do about it.Okwu
what version of SQL Server Developer Tools do you have? It may be has sense to install the latest version of SSDT from learn.microsoft.com/en-us/sql/ssdt/…Cooee
R
12

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

Runion answered 18/10, 2018 at 20:16 Comment(0)
P
8

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.

Plastered answered 10/5, 2019 at 22:26 Comment(0)
C
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

Caritta answered 17/2, 2022 at 7:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.