How can I check what the collation of a temporary table is?
I want to do this because I want to check what happens if I have database with a specific collation, different from the SQL Server instance and create a temporary table.
Let's say we have this scenario:
SQL Server 2008 - Latin1_General_CS_AS
Test Database - Estonian_CS_AS
Then create table #Test
without specifying the collation. Which will be the collation of the table?
I think Estonian_CS_AS
, but in the test I am doing is said Latin1_General_CS_AS
. That's why I need to find a SQL statement to check this.
Note: from what I have read, I think that the collation of a temporary objects is defined by the tempdb
collation. But if this is true, what defines its kind?
tempdb
is recreated when the server start and gets the collation from the model
database.
Temp tables you create without specifying the collation will have the collation of tempdb
. When creating temp table you can use database_default
as collation to get the same collation as the current database.