今天安装程序,发现在创建存储过程的时候报错。仔细分析一下,发现是存储过程的变量大小写不一致。于是,开始研究是什么配置决定的。
最后发现是随着sql server实例的配置变化。换句话说,数据的大小写可以在每个库中控制,甚至按字段控制。但是,sql脚本就不行了。
下面是从MSDN里面抄出来。
SQL Server 2005/2008的标识符的排序规则取决于定义标识符的级别。为实例级对象(如登录名和数据库名)的标识符指派的是实例的默认排序规则。为数据库对象(如表、视图和列名)的标识符指派的是数据库的默认排序规则。连接上下文与一个数据库关联后,可以创建变量、GOTO 标签、临时存储过程和临时表;该上下文切换到其他数据库时,可以引用它们。因此,变量、GOTO 标签和临时表的标识符使用实例的默认排序规则。
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. 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. Therefore, the identifiers for variables, GOTO labels, and temporary tables are in the default collation of the instance.
学无止境!!!