I have an existing SQL Server 2014 database and I want to add it to source control (SSDT in Visual Studio 2017).
I have a database project with lot's of views and stored procedures.
MyDatabase
is current database.
Every view and stored procedure is written in the following way:
create view MyView
as
select
Id
from MyDatabase..MyTable
".." means the default schema name here (dbo). And it works in SQL Server. But SSDT considers such a construct as an error:
View MyView has an unresolved reference to MyDatabase.dbo.MyTable.
So SSDT knows perfectly well, that database is MyDatabase
and skipped schema name is dbo
.
But I can't build my project with such errors. I can't also rewrite MyDatabase..MyTable
to MyDatabase.dbo.MyTable
.
So is there any way to solve this problem SSDT?
The 3-part name could be replaced as
[$(DatabaseName)]..MyTable
: