views:

650

answers:

3

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 teh 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.

Thanks,

+1  A: 

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.

Anders Abel
Actually all objects are part of the DB project. The stored procedure is in MyDatabase. I accepted the defaults when I created the project, but I expect I missed something along the way.
beezler
+1  A: 

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

Thanks for your help.

beezler
Marking this item as the correct answer will move it to the top of the page, which will make it easier for others to find later.
Pedro

related questions