Collation of database and names of tables in SQL Server 2012 in diffrent statement

This post show how work creating and inserting, selecting data from tables with the same name of table but with diffrent size of letters in this name.

Begin with set collation to your database.

ALTER DATABASE mydb
COLLATE Polish_CI_AI;

This database is insensitive, so two diffrent size of letter will be as the same(example a=A).
Now create table of t name.

create table t (id int);

t1Table t was creared.
After that create table with T name.

create table T (id int);

t2
Table t wasn’t creared.  The table with similar name is existing.
And try insert data into t table, but using T name.

insert into T values(3);

t3If You select all records from t table, You see setting data.

select id from t;

t4
The same effect will be to select data using T name of table:

select id from T;

t4
So only creating table name with lower or upper letter is treat as the same.

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.