Blog Post

Collation: Correction -> Instance

,

I had a recent run in with collation problems and it got me started reading about them. As I read I started to realize that for a seemingly simple subject there was a lot to it. So I thought I would go over some of what I found out.

You’ve installed your instance, created your database, created your tables even started running your queries. And then you realize that at some level or another you’ve made a mistake and now you need to change your collation. This gets more complicated the farther up the chain you go. In particular changing the collation of an instance is a big pain. In fact it is such a big pain I highly recommend not doing it. Plan ahead carefully so that you never have to mess with this. However, since life happens:

Instance

There is no easy way to do this I’m afraid.

  1. Goes without saying but back up all user and system databases
  2. Detach all of your user databases
  3. Script out all of your server principals (logins, user defined roles, certificates etc) and any jobs.
  4. Back up any DTS packages (hopefully none) and any SSIS packages
  5. List out any configurations
  6. Script out any changes to the model database
  7. Any other changes that you might have made to the original system databases that I might have forgotten. Microsoft has a good list of what to do here: Rebuild System Databases
  8. Rebuild the system databases using setup and the new collation. See the above link
  9. Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=InstanceName
    /SQLSYSADMINACCOUNTS=accounts [ /SAPWD= StrongPassword ] 
    /SQLCOLLATION=CollationName
  10. Reattach all of the user databases
  11. Use the methods I mentioned in the previous post to change the collation for each of the databases

 


Over a number of different posts I’m going to discuss some of the surprisingly deep subject of collation.

As a start listen to Rob Farley’s hilarious talk on collation
Collation: Definition
Collation: Location
Collation: Expression
Collation: Correction -> Expression, Column, Database
Collation: Temporary objects & variables: Demonstration
Collation: Confusion

Filed under: Collation, Microsoft SQL Server, SQLServerPedia Syndication, System Databases Tagged: code language, collation, language sql, microsoft sql server, system databases

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating