I find the way TFS looks for objects (tables, procs, functions, view) to be bizarre. In mgmt studio this is a non problem (mgmt studio resolves any reference known to the server) and with TFS and databases, it's a huge thing. I am getting a lot
of these messages:
Error 56 SQL03006: View: [dbo].[DAILY_SUM] has an unresolved reference to object [stage].[dbo].[gldetail].
First question. Is there some simple way to tell TFS not to try to resolve references? Plus TFS seems to care if a View references an object but doesn't care is a proc reference the same object. So I import the other database, compile it
to get a dbschema file, and when I do that I get a bunch of these error messages because we have a lot of common functions across all our databases:
Error 60 SQL04105: The model already has an element that has the same name dbo.fn_daysInM.fk_version.
We are using TFS 2010 and in this case ms sql 2005, although we have a lot of ms sql 2008. So is there some better approach to Build'ing databases as regards resolving object references?
Based on your description, it seems that you now use TFS to build and deploy your database project. And for one thing you need to be aware is that TFS run builds on the TFS build agent machines, so you need to make sure you have the required software
and resources environment on that build agent machine so that you can get your build built successfully.
And for your current scenario, it seems that the [dbo].[DAILY_SUM] view references objects in the [stage] database. So you need to first create a database project for the [stage] database, and then add database reference in the original database project.
For further information about how to add database reference, see:
http://msdn.microsoft.com/en-us/library/dd193259(VS.100).aspx After that, you need to check in these 2 database projects into TFS version control so that TFS can get the required files when build the project.