Reputation:
I have imported database as a project into Visual Studio 2013 as part of Data Project. When I look at all my warnings I see SQL71562
messages that correspond to unresolved reference to object
. When I looked at those stored procedures that are causing warnings they reference tables in same database by [DatabaseName].[dbo].[TableName]
instead of [dbo].[TableName]
. is there way to resolve all those errors at once without having to remove [DatabaseName]
from object name?
Upvotes: 5
Views: 6372
Reputation: 517
You could remove [DatabaseName]. completely if in most cases the used tables/objects reside in the same db because then it is not required to definde a db Name..
Or you could follow lucazav's correct suggestion and replace it with a variable.
Upvotes: -1
Reputation: 878
SSDT provides a set of pre-defined SQLCMD variables. One of these is $(DatabaseName), that provides the current database name.
So you can replace your [DatabaseName] with [$(DatabaseName)] and it should work.
Upvotes: 4