question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(SQL server) Collation when creating a database

See original GitHub issue

Hi @Zaid-Ajaj,

When creating a new ThrowawayDatabase I need to specify a custom collation for the entire database, so my required SQL script is as follows:

CREATE DATABASE [MyDatabase] COLLATE MyCollation

Currently a workaround is possible by running this script after the ThrowawayDatabase has been created, but wouldn’t it be nicer if the collation could be specified already when creating the database?

ALTER DATABASE [MyDatabase] COLLATE MyCollation

If you think it’s a good feature to have I could help with a PR. I have already considered an option how it can be done. My first idea was adding a new optional string parameter, but unfortunately it results in the overload problem of the Create method. image

Therefore, I think the only option would be adding a new class (e.g. ThrowawayDatabaseOptions) with all the required parameters (currently DatabaseNamePrefix and Collation), but it’s a breaking change of the API.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
Zaid-Ajajcommented, Dec 19, 2020

That worked!! 😍 Just ran all tests and all 31 of them passed ✔️

1reaction
MihailsKuzminscommented, Dec 19, 2020

I don’t mind adding proper unit tests, I just couldn’t find the time to actually do it 😅

I will do it then 😎

Read more comments on GitHub >

github_iconTop Results From Across the Web

Collation and Unicode support - SQL Server
A collation specifies the bit patterns that represent each character in a dataset. Collations also determine the rules that sort and compare ...
Read more >
SQL SERVER - Creating Database with Different Collation ...
It is absolutely possible to database with a different collation on a same SQL Server Instance. It is also possible to create an...
Read more >
SQL Server collation introduction with collate SQL casting
SQL Server collation refers to a set of character and character encoding rules, and influences how information is stored according to the ...
Read more >
How to Set the Collation of a Database in SQL Server (T- ...
Specifically, you can use the COLLATE clause of either the CREATE DATABASE or ALTER DATABASE statements. The COLLATE clause is optional – if...
Read more >
SQL Server Collation
Collations in SQL Server provide sorting rules, case, and accent sensitivity properties to data. A collation defines bit patterns that ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found