<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>Serge&#039;s Technology View &#187; collationname</title>
	<atom:link href="http://blog.dragonsoft.us/tag/collationname/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dragonsoft.us</link>
	<description>Talk about Technologies, Software Architecture and Management</description>
	<lastBuildDate>Tue, 31 Jan 2012 01:43:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SQL Server Collation. An enemy or a friend?</title>
		<link>http://blog.dragonsoft.us/2008/04/15/sql-server-collation-an-enemy-or-a-friend/</link>
		<comments>http://blog.dragonsoft.us/2008/04/15/sql-server-collation-an-enemy-or-a-friend/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 00:51:35 +0000</pubDate>
		<dc:creator>Serguei Dosyukov</dc:creator>
				<category><![CDATA[Fun stuff with SQL Server]]></category>
		<category><![CDATA[change database collation]]></category>
		<category><![CDATA[collation]]></category>
		<category><![CDATA[collationname]]></category>
		<category><![CDATA[sql server]]></category>
		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=167</guid>
		<description><![CDATA[Is SQL Server Collation setting your enemy or your friend? How to change server default collation? In general, it is your friend, it will help SQL Server to figure out how to store character strings in different locale. It becomes &#8230; <a href="http://blog.dragonsoft.us/2008/04/15/sql-server-collation-an-enemy-or-a-friend/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Is SQL Server Collation setting your enemy or your friend? How to change server default collation?</p>
<p>In general, it is your friend, it will help SQL Server to figure out how to store character strings in different locale. It becomes even more important when data you are storing goes beyond regular ANSI charset (Chinese, Japanese, etc.).</p>
<p>In my case I, from time to time work with Cyrillic. Being born and raised in Russia, I am native Russian speaker. As a result I am keeping Cyrillic enabled on my machine as main locale setting.</p>
<p>It is OK in many instances, but when it comes to SQL Server or some other applications which are trying to be smart in this area, it becomes a problem.</p>
<p>If you install SQL Server instance in such environment, you would get something like that</p>
<p>Let check collation for some database I have</p>
<pre class="brush: sql; title: ; notranslate">SELECT databasepropertyex(db_name(),'collation') AS collation_name</pre>
<p>In my case result would be</p>
<p> Cyrillic_General_CI_AS</p>
<p>If you are at home, it may be fine, but at work when your primary locale is SQL_Latin1_General_CP1_CI_AS<br />
it could be a problem since you often will run into error when execution of the SQL code across different databases will return Collation error.</p>
<p>Too late? Not exactly.</p>
<p>In many cases your solution would be to adjust Collation setting for the database using to following code:</p>
<pre class="brush: sql; title: ; notranslate">ALTER DATABASE DatabaseName COLLATE SQL_Latin1_General_CP1_CI_AS</pre>
<p>Problem would still exist though, any new database created will get default Collation setting from &#8230; MASTER database for your SQL Server Instance.</p>
<p> And here some hoops will be required. Following steps will help you overcome the issue:</p>
<ol>
<li>Detach all your user databases</li>
<li>Stop your SQL Server</li>
<li>In <strong>C:\Program Files\Microsoft SQL Server\80\Tools\Binn\</strong> folder locate <strong>rebuildm.exe</strong> and run it. This utility which comes with SQL Server (you will need to have client tools to be installed) allows you to repair your master database from original installation CD/DVD/Folder and also change default Collation Setting for your SQL Server instance. Go to Settings and choose appropriate collation designator or SQL Collation.<br />
If you cannot find rebuildm.exe, it means you are using SQL Server 2005 or 2008. Then the following may help:<br />
<a href="http://msdn.microsoft.com/en-us/library/ms144259(SQL.90).aspx" target="_blank">for SQL Server 2005</a></p>
<pre class="brush: plain; title: ; notranslate">
start /wait &lt;CD or DVD Drive&gt;\setup.exe /qn INSTANCENAME=&lt;InstanceName&gt; REINSTALL=SQL_Engine REBUILDDATABASE=1 SAPWD=&lt;NewStrongPassword&gt;</pre>
<p><a href="http://blogs.msdn.com/psssql/archive/2008/08/29/how-to-rebuild-system-databases-in-sql-server-2008.aspx" target="_blank">for SQL Server 2008</a></p>
<pre class="brush: plain; title: ; notranslate">
setup.exe  /QUIET  /ACTION=REBUILDDATABASE  /INSTANCENAME=instance_name  /SQLSYSADMINACCOUNTS= accounts   [/SAPWD=password]
</pre>
</li>
<li>Rebuild your master database</li>
<li>Reattach your user databases</li>
<li>Check that collation for master and user databases is a desired using first query above.</li>
</ol>
<p>This is much easier then to recreate a SQL Server instance from scratch.</p>
<p><strong>Note. </strong>There is less safe way of getting the same result &#8211; adjust Windows Registry.<br />
Your default collation name is stored under</p>
<pre class="brush: sql; title: ; notranslate">HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\
DefaultCollationName</pre>
<hr/><span style="font-size: 7pt">Copyright &copy; 2012 <strong><a href="http://blog.dragonsoft.us">Serge&#039;s Technology View</a></strong>. This Feed is for personal non-commercial use only.</span>]]></content:encoded>
			<wfw:commentRss>http://blog.dragonsoft.us/2008/04/15/sql-server-collation-an-enemy-or-a-friend/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

