Options

SQL71558 The object reference differs only by case

TomAgTomAg Posts: 1 New member
Hi,
I am using Visual Studio 2022 with SQL Prompt. 
I have multiple errors in Visual studio build about case difference.

example:
I have a stored procedure that does  SELECT bankid FROM [db1].[dbo].[table1]
Error SQL71558: The object reference [db1].[dbo].[table1].[bankid] differs only by case from the object definition  
[db1].[dbo].[table1].[BankID]

The build is basically saying to do SELECT BankID FROM [db1].[dbo].[table1]
because in table1 the column is BankID. 
Build fails. And I have multiple errors like this. 
I know I can cancel in the project properties "validate casing on identifiers". That is not what I am looking for. 
I want SQL promt to change the stored procedure automatically in all solution. 
Is there a way? 
I can't seem to find it. 
Tagged:

Answers

  • Options

    Hi @TomAg

     

    Thank you for reaching out on the Redgate forums regarding your casing concern in Visual Studio.

     

    SQL Prompt should be able to help with casing formatting when you are working with an open .SQL file with active connection to your database.

     

    In your formatting style there is a section in Global > Casing to set how casing is applied for keywords, functions, data types & variables.

    Setting these as expected and then formatting your code should start to bring it in line with the formatting of code in your database.

     Once you've set your style as active, it can be applied by running format code in Extensions > SQL Prompt > Format code

     


    If you have an active SQL Toolbelt/Toolbelt Essentials subscription, you can also bulk update SQL files through Extensions > SQL Prompt > Bulk Actions > Format SQL Files. This will quickly apply your SQL Formatting to multiple files at once.

    https://documentation.red-gate.com/sp/features-available-only-in-sql-toolbelt-essentials-and-sql-toolbelt/bulk-operations

    Jon Kirkwood | Technical Support Engineer | Redgate Software
Sign In or Register to comment.