How can we help you today? How can we help you today?

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!

Hakim Ali
0

Comments

1 comment

  • Pete_Ruiz
    Hello Hakim,

    Unfortunately, SSDT compatibility in SQL Compare and SQL Source Control is an unsupported beta feature.

    At this time there is no feature available to ignore this construct or to replace "[$(LinkedServerName)]" with "LinkedServerName" at deployment time."

    I'm not sure if this is helpful but you could possibly ignore these all together by configuring a customer filter (might or might not work): https://documentation.red-gate.com/sc13/reviewing-the-comparison-results/using-filters
    Pete_Ruiz
    0

Add comment

Please sign in to leave a comment.