Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.
I was testing some changes recently and needed to verify how things worked in a different collation. Here’s the scenario: I had this situation and ran a query.
As you can see, the query rates these two Unicode strings as equal, which makes some sense as this is a Case Insensitive, Accent Sensitive, default US English database.
I then went to the database properties to change this. When I did so, I picked a case sensitive collation.
I clicked OK, and a few minutes, later I get this:
Hmmm, why is this locked on my workstation? I have a query window open. Changing a collation is potentially a disruptive operation and requires an exclusive lock on the database. This means no other users can be inside the database with a connection.
The solution? Change the context of my query window. I can change this to master (or any other database) and make the change again.
While collation isn’t something you often change, if you do find a database that needs this alteration, you will need to drain off any connections before you can make this change.
I ran across this while doing testing and realized this was a nice, short piece of information that I should remember. Not because I do this often, but because as I automate changes and use pipelines, I’d need a way to remove all connections before this would deploy.
An example of a nice short piece of information that I can document about my knowledge, and that might get asked about in an interview.