VS 2010 build database project receive SQL04151

和自甴很熟 提交于 2019-11-30 22:39:29

问题


I just started working with the Visual Studio 2010 Premium database project. I must say it does indeed rock. One thing I can't figure out is how to avoid the SQL04151 warning

Procedure: [dbo].[MyProc] has an unresolved reference to object [MyDatabase].[dbo].[MyItem].

Did I miss a simple step somewhere? All I can find online involves tempdb.


回答1:


I need to substitute [MyDatabase].[dbo].[MyTable] with [$(DatabaseName)].[dbo].[MyTable]. This cleared up the warnings.

Thanks for your help.




回答2:


In your [dbo].[MyProc] procedure you reference [MyDatabase].[dbo].[MyItem] which is probably not part of your DB project. Even though the object exists in the DB, it is not known to Visual Studio during compilation and thus yields an error.

Normally you should have the entire DB-schema in the DB-project. Otherwise I think there is something called "partial DB projects" that you can look into.




回答3:


MS has acknowledged this as a bug they are working on:

https://connect.microsoft.com/VisualStudio/feedback/details/543657/4151-unresolved-reference-warning-for-tempdb




回答4:


Check you have set Build Action to Build on Properties pane for the specified object..



来源:https://stackoverflow.com/questions/2568548/vs-2010-build-database-project-receive-sql04151

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