SSDT – The object reference differs only by case from the object definition warning


Well here’s a Visual Studio SQL Server Data Tools (SSDT) warning I haven’t come across before. I suspect the problem occurs only when performing a join to an external database reference dacpac. Luckily, the fix is simple (although a bit time consuming if you have very many of these warnings).

"TableKey" is not the same as "tablekey"!
“TableKey” is not the same as “tablekey”!

First, the warning message will look very similar to this:

Warning 1 SQL71558: The object reference [dbo].[YourTable].[yourtablekey] differs only by case from the object definition [dbo].[YourTable].[YourTableKey]. C:\1-Phil\tfs\YourSolution\YourProject\dbo\Stored Procedures\YourProc.sql 1 1 YourProject

What it’s telling you is you should change the casing in the query to ensure you won’t get caught up in an issue if the collation of the external database reference is case sensitive.

The fix is easy.

  1. Double click the warning to open up the offending file.
  2. Search the file using a case sensitive search for the first column referenced in the warning. In my example “yourtablekey”.
  3. Change the casing of the references to match the casing of the second column listed in the warning message. In my example “YourTableKey”
  4. Save the file and the warning should be resolved.

You are now a hero.

In general I love SSDT though there are definitely some tips and tricks to get used to. Click the link below if you’re interested in checking out more posts related to Visual Studio SQL Server Data Tools (SSDT).

 


Leave a Reply

Your email address will not be published.