Case-sensitive variable names in SQL Server?

When I execute this SQL command format SP_HELPTEXT Sproc1. The result set will be displayed Could not find stored procedure 'SP_HELPTEXT'. But if I replaced the SQL command with a lowercase type SP_HELPTEXT Sproc1, it will definitely display the contents of Sproc1.

Im using Sproc1in my program, and when the program executes Sproc1, it will return a message:

Must declare the variable '@Variable1'. 

Although I have already declared this particular variable.

I have a hint that the problem is related to sorting settings, case sensitive or case insensitive. Does anyone know how to solve a problem?


Another situation is when case-sensitive variable names appear:

CREATE PROCEDURE Foo @customerID int AS
PRINT @customerId
+3
1

.

( ) , .

sp_helptext, , . , sp_helptext, .

, , @Variable1 . @Variable1 @Variable1.

, , .

SELECT SERVERPROPERTY('collation');

SQL Server:

COLLATE (Transact-SQL)

, .

  • , , .
  • , , , .

    , , , , . . .

  • , GOTO, . .

    , GOTO, , , , .

.

+4

Source: https://habr.com/ru/post/1717254/


All Articles