问题描述
当我尝试从我的VS2010数据库项目中引用链接服务器时,似乎无法解决"未解决的引用"问题。我已经搜索了解决方案,但似乎没有解决我的问题。我有以下项目
setup:
I cannot seem to resolve an 'Unresolved reference' problem when I attempt to reference a linked server from within my VS2010 database project. I have searched for solutions and none of them seem to resolve my problem. I have the following project setup:
1. 具有已定义链接服务器(ServerDB)的数据库服务器项目
1. A database server project with a defined linked server (ServerDB)
2 。具有存储过程的数据库项目(RefDB)
2. A database project (RefDB) with a stored procedure
3。第三个DB项目(TestDB),包含2个数据库引用 - 一个到ServerDB,一个到RefDB
3. A third DB project (TestDB) which contains 2 Database references - one to ServerDB and one to RefDB
4。从TestDB我尝试使用3部分名称引用RefDB中的存储过程 - 这是成功的(没有错误或警告)
4. From TestDB I attempt to reference the stored procedure in RefDB using a 3 part name - this is successful (no errors or warnings)
5。从TestDB我尝试使用4部分名称(通过链接服务器)引用RefDB中的存储过程 - VS2010返回'SQL04151未解析的对象引用' 警告
5. From TestDB I attempt to reference the stored procedure in RefDB using a 4 part name (via linked server) - VS2010 returns a 'SQL04151 unresolved reference to object' warning
6。如果我在ServerDB项目中创建一个存储过程并从TestDB引用它(使用2部分名称),这可以正常工作(所以我知道我的dbschema引用是可以的)
6. If I create a stored procedure within the ServerDB project and reference this from TestDB (using a 2 part name) this works fine (so I know my dbschema references are okay)
7。我曾尝试使用sqlcmdvars来解决这个问题但无济于事。链接服务器定义实际上是指有效的服务器实例。区分大小写也不是问题。
7. I have tried using sqlcmdvars to resolve this but to no avail. The linked server definition does actually refer to a valid server instance. Case sensitivity is also not an issue here.
这个问题真的还没有解决方案,或者我在这里做错了什么?
Is there really still no solution to this problem or am I doing something wrong here?
谢谢
Graham
推荐答案
您在此博客中看到的警告:
http://blogs.msdn.com/b/gertd/archive/2009/06/10/system-objects -in-tempdb.aspx ,您可能想要修改数据库引用中的Literal Value,将其设置为RefDB。
The warning you see was discussed on this blog: http://blogs.msdn.com/b/gertd/archive/2009/06/10/system-objects-in-tempdb.aspx, You may want to modify Literal Value in database reference, set it to RefDB.
加法参考FYI:
- http://connect.microsoft.com/VisualStudio/feedback/details/543657/4151-unresolved-reference-warning-for-tempdb 功能
- http://social.msdn.microsoft.com/forums/en-us/vstsdb/thread/46810DB7-5C68-405C-AF6E-9DD389205751
最好的问候,
这篇关于链接服务器未解决的参考问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!