Update target button is disabled after schema comp

2019-01-18 08:08发布

I have created database project using VS 2012. Once the schema comparison is done, the update target button should be enabled to sync with target.

But it's not getting enabled. Any help plz.

I'm using VS 2012 with sp 3, SQL Server 2012,

enter image description here

10条回答
戒情不戒烟
2楼-- · 2019-01-18 08:49

It seems your database project has sqlcmd variables without default values.

See: http://www.andrewburrow.net/vs2012-schema-compare-buttons-disabled/

Hope this helps.

查看更多
别忘想泡老子
3楼-- · 2019-01-18 08:51

In SSDT I had the case where the update button was enabled but the generate script was not enabled. This was because my destination schema was my local solution (the *.sqlproj vs project).

It took a few minutes to dawn on me that the destination needed to be a real database to correctly generate the script.

查看更多
甜甜的少女心
4楼-- · 2019-01-18 08:56

I couldn't see any errors in Error List, but I could see the errors in the Output tab

enter image description here

查看更多
Melony?
5楼-- · 2019-01-18 08:58

Workaround 2:

In my case, the Update button was greyed out because of there were errors warnings about a view that I created and added to the project earlier. The problem was that the view was scripted to use full database qualified object naming. E.g. [databasename].[schemaname].[objectname], which works fine in SSMS, but causes a problem when it is checked in a DB Project. If you use three part naming for referring an object in same DB project results in a error/warning in Visual Studio.

By changing the code to [schemaname].[objectname] in the definicion of the view removed the error warnings and enable the Update option. Happy days!

Credits: https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/3577074-allow-three-part-naming-for-referring-a-db-object

https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/17396128-keep-update-and-generate-update-script-buttons

查看更多
▲ chillily
6楼-- · 2019-01-18 09:06

See if you have a "warning" message stating "Cannot generate deployment plan due to an internal error". If so, the Update and Generate Script buttons will be disabled.

Close Visual Studio, navigate to the folder containing the Database project and remove all (*.dbmdl) files. Then restart Visual Studio, re-run the compare schema at which point the Update button should be enabled.

查看更多
Bombasti
7楼-- · 2019-01-18 09:07

For me, there were no errors visible in the Error List. This was because I had the "Show Issues Generated" drop down was set to "Build Only"; changing it to "Build + IntelliSense" allowed me to see the SQL errors that needed to be fixed to enable the Generate Script and Update buttons.

查看更多
登录 后发表回答