質問

We are using Visual studio 2010 and our database scripts are in a database project.
We have two databases DB1 and DB2. DB1 uses DB2.
I created a database project for each of databases and added DB2's .dbschema file as a "Database Reference" to DB1's project. So my code for my view in DB1 is like

CREATE VIEW dbo.myView 
AS 
SELECT * FROM [$(DB2Ref)].dbo.SomeTable
GO 

Until here all is fine. But when i make a schema comparison between actual DB1 database and DB1 database project, comparison finds a difference between "myView" in project and "myView" in database.

Is there a way to make schema comparisons igonore these referenced database variables ?

役に立ちましたか?

解決

Yo can set the Default for the SQL CMD Variable in the project settings to the actual database name. The schema compare in visual studio will then know that there is no change. Unfortunately if you compare against different databases with different names, you'll need to change this Default each time to the database you're comparing to.

Setting SQL Cmd variable Default

SQL Schema Compare of View - the top is without the default defined and thus the object is marked as a change, and the bottom with the variable defined and thus marked as no-action

Sorry not enough rep to add images or more than 3 links yet

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top