Case sensitivity in SQL Server 2005
I have a stored procedure in which I declare a variable DECLARE @intCount int
and use it throughout the stored procedure as @intcount
.
I executed this stored procedure in 3 databases and they all executed successfully, but when I executed it on the fourth database it displayed a message
must declare variable @intcount.
Now when I renamed it to @intCount
in every part of the stored procedure, it executed on the fourth database also.
Does this mean that SQL Server is case sensitive? I knew that it was not and the same I can observe in other 3 databases.
Is there any way I can turn off this case sensitivity of S开发者_如何学PythonQL Server?
Change the default collation to case insensitive, or write SQL that is case sensitive.
http://msdn.microsoft.com/en-us/library/ms184391.aspx
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 Identifiers.
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. The identifiers for variables, GOTO labels, temporary stored procedures, and temporary tables are in the default collation of the server instance.
精彩评论