Is the collcation and instance of the SQL server variable name consistent with the current DB?

Source: Internet
Author: User

When using SQL Server variables, the variable name is case-insensitive:

 

 

The current database is case-insensitive, but after declaring the variable, it is found that the variable name is case-sensitive. We always think that the collcation of the variable name of SQL Server is consistent with that of the current database. In msdn:

You cannot specify a collation for character variables and parameters; they are always created with the default collation of the database. http://msdn.microsoft.com/en-us/library/aa174903 (V = SQL .80). aspx

 

However, this article only mentions that the variable data is consistent with the current data, but does not mention the collcation of the variable name. The same problem was found in the msdn Forum. Microsoft engineers replied as follows:

 

Please note that variable Collation is based on the server side (Master dB) Collation, not on the user database collation.

For example if you have a case sensitive server, but a case-insensitive user database the variable demo-ons are case sensitive, since they live in memory of the server, and that uses the server collation. http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/0d833fab-2b32-4b98-a3ab-cdf8c743e5e0)

 

In conclusion, we can conclude that the collcation of the SQL server variable name is the same as that of the system master database, that is, the collation of the instance.

 

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.