I recently ran into an issue where the SSDT compiler in Visual Studio was misreporting an error and I wanted to post about the setup and work-around.
SSDT, also known as SQL Server Data Tools, is an add-in for Visual Studio that allows you to develop and deploy SQL database projects.
The Setup
SSDT allows you do some nice things such as turn on code analysis for best practices and treat any warnings as errors. In addition, in order to keep your code clean it also gives you an option to “Validate Casing on Identifiers”.
We have this enabled, as seen below.
We use synonyms to isolate our connection points between databases as such.
Normally, this works without a hitch as we do a straight data extract before performing our transforms. However, for performance we needed to do some record limiting and add a join between two synonyms, as such.
As soon as we added the join and tried to build the compiler started misreporting an error:
The Solution
There are a few solutions.
For one we could turn off the project property “Validate casing on identifiers”. However, because having this enabled is helpful we did not want to disable it.
Since our data pull logic was isolated in a stored procedure we instead opted to just turn off this error check for the single procedure, until Microsoft releases a fix.
To disable the error on the procedure you only need to right-click on the procedure and view properties, and on the properties page enter the error number “71558” into the Suppress TSql Warnings property.
I did find some an old post in 2011 describing this problem. Hopefully, it will be fixed in a future version of SSDT.
Let me know if you found this post useful, or if you have any other tips and tricks you have found for synonyms in the comments below.
I think the article is very helpful for people,it has solved our problem,thanks!
Great! Glad it helped
I simply want to tell you that I am beginner to blogs and honestly savored your web page. More than likely I’m likely to bookmark your blog . You definitely have amazing well written articles. Cheers for sharing with us your blog site.
Im obliged for the blog post. Keep writing.
Thanks for the article post.Really thank you! Keep writing.
Thanks again for the blog article.