What are the challenges you face when working across database platforms? Take the survey
Options

SSDT Linked Server Variable Name Syntax

I have Visual Studio SSDT database projects backed by TFS source control. Linked servers in those projects are coded as follows:

[$(LinkedServerName)]

SSDT requires that syntax, with the square brackets, dollar sign, and parentheses to refer to linked servers. So SSDT code looks like this:
select Column from [$(LinkedServerName)].DatabaseName.Schema.Table

Once deployed to the database, it looks like this:
select Column from LinkedServerName.DatabaseName.Schema.Table

When I do a schema comparison/deployment from source control to database, SQL Compare flags this difference:

[$(LinkedServerName)] <> LinkedServerName

Not only that, it wants to deploy the SSDT syntax to the database server, with square brackets and dollar sign and parentheses, and this results in a syntax error.

Questions:
1. Is there a way to get SQL Compare to ignore this construct?
2. Is there a way to get SQL Compare to replace "[$(LinkedServerName)]" with "LinkedServerName" at deployment time?

Surely I can't be the first person to have faced this problem, but a search on Google as well as Red-Gate forums returns no results for this. Thanks for helping!

Answers

Sign In or Register to comment.