Management Studio

Find Collations For Your SQL Instance And The Databases

Here’s some sql logic to get the SQL Server Collation ( Instance Collation ), and the Database Collation.

use master;
set nocount on

declare	@mydatabasename		varchar(255)
set		@mydatabasename		= 'msdb'  -- I'm using MSDB as an example

select
	'server name'			= serverproperty('servername')
,	'server collation'		= convert(varchar, serverproperty('collation'))
,	'database name'			= @mydatabasename
,	'database collation'	= databasepropertyex(@mydatabasename, 'collation');

Here’s a quick screenshot.

get_sql_instance_collation_and_database_collation

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s