Unresolved Reference in Visual Studio 2012 Database Project

会有一股神秘感。 提交于 2019-12-31 02:09:26

问题


Is there a way to reference another database from my database project without directly referencing it?

For example, I want to be able to write something like this:

CREATE VIEW View1
AS
  SELECT X FROM OtherDB.dbo.Table1

回答1:


Your best bet is to add a database reference to your project. For VS2010 and lower DBProj files, you'll want to generate a dbschema file and add it as a database reference. For SSDT, you'll want to use a dacpac file. This works well for projects that are mostly static and you can even tailor them down to just include the objects that are relevant.

VS2010, 2008 - http://msdn.microsoft.com/en-us/library/dd193283%28v=VS.90%29.aspx has the documentation you'll need to export an existing database into a dbschema file. Place it somewhere your project can access it and add it as a "Database Reference".

SSDT - http://msdn.microsoft.com/en-us/library/hh550080%28v=VS.103%29.aspx gives you the command line reference for generating a dacpac file. Once generated, place it somewhere your project can access it and add as a database reference.

I've got a blog post on this for SSDT here: http://schottsql.blogspot.com/2012/10/ssdt-external-database-references.html



来源:https://stackoverflow.com/questions/17193505/unresolved-reference-in-visual-studio-2012-database-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!