Case sensitive variables in SQL Server -


i have sql server several databases. want 1 of these databases case sensitive names of variable , others not.

i need change settings run script without errors

declare @a int declare @a int 

how can change 1 database case sensitive (for variable names), while allowing other databases on instance case insensitive variable names?

you need change server collation case sensitive behavior want. changing collation db not enough.


the default collation of sql server installation, sql_latin1_general_cp1_ci_as not case sensitive.

it sounds want modify collation of server 1 case-insensitive. choose 1 _cs. _ci means "case insensitive", , case-sensitive _cs. maybe you'll want latin1_general_cs_as.

this great answer previous question on changing sql server collation case insensitive case sensitive?.

from sql server books online:

collate (transact-sql)

the collation of identifier depends on level @ defined.

  • identifiers of instance-level objects, such logins , database names, assigned default collation of instance.
  • identifiers of objects within database, such tables, views, , column names, assigned default collation of database.

    for example, 2 tables names different in case may created in database case-sensitive collation, may not created in database case-insensitive collation. more information, see database identifiers.

  • the identifiers variables, goto labels, temporary stored procedures, , temporary tables in default collation of server instance.

    variables, goto labels, temporary stored procedures, , temporary tables can created when connection context associated 1 database, , referenced when context has been switched database.

you can check server collation using:

select serverproperty('collation');  sql_latin1_general_cp1_ci_as (1 row(s) affected) 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -