我需要更改设置,以便我可以毫无错误地运行此脚本
DECLARE @A int DECLARE @a int
解决方法
sql Server安装的默认排序规则sql_Latin1_General_CP1_CI_AS不区分大小写.
听起来您想要将服务器的排序规则修改为不区分大小写的排序规则.选择一个_CS. _CI表示“不区分大小写”,区分大小写是_CS.也许你会想要Latin1_General_CS_AS.
这是对Changing SQL Server collation to case insensitive from case sensitive?上一个问题的一个很好的答案.
07002
The collation of an identifier depends on the level at which it is defined.
- Identifiers of instance-level objects,such as logins and database names,are assigned the default collation of the instance.
Identifiers of objects within a database,such as tables,views,and column names,are assigned the default collation of the database.
For example,two tables with names different only in case may be created in a database with case-sensitive collation,but may not be created in a database with case-insensitive collation. For more information,see 07003.
The identifiers for variables,GOTO labels,temporary stored procedures,and temporary tables are in the default collation of the server instance.
Variables,GOTO labels,temporary stored procedures,and temporary tables can be created when the connection context is associated with one database,and then referenced when the context has been switched to another database.
您可以使用以下方法检查服务器排序规则
SELECT SERVERPROPERTY('collation'); sql_Latin1_General_CP1_CI_AS (1 row(s) affected)