Skip to main content

Notes on changing SQL Server's Collation

The SQL_Latin1_General_CP1_CI_AS collation is a legacy collation and we are recommended by Microsoft to use the supported Latin1_General_CI_AS. So when I was installing a cluster recently to host the databases for SCOM 2012 I chose the latter. This was a mistake as unfortunately it still requires the old collation

How to change a SQL Server's collation after you've installed it is well documented and so is the command, but there are a couple of gotchas that might be worth remembering.

The command executed from a cmd.exe window is:


  • Probably due to the /QUIET option virtually no progress or errors are returned - you just need to wait for five minutes looking at an empty DOS box while it does its thing.
  • The user account name and SA password should not be in quotes or square brackets
  • The SQL services need to be stopped for the command to work. BUT, just as you think that it has completed successfully you find the collation hasn't changed despite no errors. The output from the DOS window may say the command completed but check out the log file it points to and you may find that there is an error listed due to an open connection to the database. In my case this was because sqlwriter.exe was running (it doesn't have an associated service). Kill the process using Task Manager and try again.
  • When in Mixed Mode the SAPWD (SA password) option has to be included. 
 I hope these small points help.


Popular posts from this blog

How to move the Microsoft Assessment and Planning Toolkit (MAP) database to a different drive

The Microsoft Assessment and Planning Toolkit (MAP) is a very useful tool for scanning your network to find instances of SQL Server plus all manner of detailed information about the installed product, OS and hardware it sits on.

<Click image to enbiggen>
There is an issue with it the database it uses to store the data it collects, however. Assuming you don't have an instance called MAPS on your server, the product will install using LocalDB (a cut down version of SQL Server Express) and puts the databases on your C: drive. If you then scan a large network you could easily expand the database to 10GB which may cause issues on a server when that drive is often one of the smallest. However, there is a simple solution: connect to LocalDB using Management Studio, detach the databases, move to a different drive, set permissions on the new location if required and reattach the database. How do you connect to LocalDB? Here you go:

Connect to (localdb)\MAPTOOLKIT

The databases I move…

SAN performance testing using SQLIO

This document describes how to use Microsoft’s SQLIO to test disk/SAN performance. It is biased towards SQL Server – which uses primarily 64KB and 8KB data pages so I am running the tests using those cluster sizes, however, other sizes can be specified.  Download SQLIO from SQLIO is a command line tool with no GUI so you need to open a command prompt at C:\Program Files (x86)\SQLIO after you have installed it. Configuration First of all edit param.txt so that you create the test file we will be using. The file needs to be bigger than the combined RAID and on-board disk caches. In this case we are using a 50GB file.
The “2” refers to the number of threads to use when testing, you don’t need to change this now. The “0x0” value indicates that all CPUs should be used, which you probably don’t want to change either, “#” is a comment. The only part you may want to change is 51200 (50GB) and the drive letter. After …

SSIS Job fails when it calls Excel via the SQL Agent but succeeds from SSDT

If you have an SSIS package which fails when run on a schedule but succeeds when executed interactively in Visual Studio/BIDS/SSDT, it may produce an error like this:
Executed as user: DOMAIN\user. Microsoft (R) SQL Server Execute Package Utility  Version 12.0.4100.1 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  10:52:25  Error: 2017-02-06 10:52:26.26     Code: 0x00000001     Source: Open Spreadsheet and Run Macro      Description: Exception has been thrown by the target of an invocation.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  10:52:25  Finished: 10:52:26  Elapsed:  0.485 seconds.  The package execution failed.  The step failed.
The issue is a type of permissions error. Excel needs to have its permissions changed via the DCOM applet in Control Panel. By default it is on “The launching user.” This needs to be changed to a user with more permissions, in this case we have used the service account used by SQL A…