| 

.NET C# Java Javascript Exception

6

This week I deployed a new feature and tried it on different SQL databases and was a bit suprised that on one database this error message came up:

Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.

This was strange, because - at least in theory - all databases have the same schema and I was sure that each database had the same collation setting.

Collations on columns

Well… my theory was wrong and this SQL statement told me that “some” columns had a different collation.

select sc.name, sc.collation_name from sys.columns sc
inner join sys.tables t on sc.object_id=t.object_id
where t.name='TABLENAME'

As it turns out, some columns had the collation Latin1_General_CI_AS and some had SQL_Latin1_General_CP1_CI_AS. I’m still not sure why, but I needed to do something.

How to change the collation

To change the collation you can execute something like this:

ALTER TABLE MyTable
ALTER COLUMN [MyColumn] NVARCHAR(200) COLLATE SQL_Latin1_General_CP1_CI_AS

Unfortunately there are restrictions and you can’t change the collation if the column is referenced by any one of the following:

  • A computed column
  • An index
  • Distribution statistics, either generated automatically or by the CREATE STATISTICS statement
  • A CHECK constraint
  • A FOREIGN KEY constraint

Be aware: If you are not in control of the collation or if the collation is “fine” and you want to do this operation anyway, there might be a way to specify the collation in the SQL query.

For more information you might want to check out this Microsoft Docs “Set or Change the Column Collation

Hope this helps!

.net web csharp asp.net javascript html5 asp.net-mvc jquery css iis
Weitere News:
4 Meinungen
0
Now the portal is permanently open wide You can go be with your child on the other side Then come back once the kid hits the sack (Woah) Life just couldn't be better https://dltutuapp.com/tutuapp-download/ https://showbox.run/ https://kodi.software/
0
Have you ever encountered a problem that seemed out of your control? And how do you deal with them? Have you really focused on entertainment? Or do you just take a break from work and still think about it? The Impossible Game will be the solution to help you forget everything to have a time of real entertainment, and also a way for you to know where your limits are!
0
HOW TO RECOVER STOLEN BITCOIN ? follow this whatsapp link: creditosantajusta@gmail.com OR Whatsapp +1(659) 210-0433
I lost my bitcoin to fake blockchain impostors on Facebook, they contacted me as blockchain official support and I fell stupidly for their mischievous act, this made them gain access into my blockchain wallet account, whereby 7.0938 btc was stolen from my wallet in total .I was almost in a comma and dumbfounded because this was all my savings I banked up on , waiting for bitcoin rate to improve . Then my niece recommended me to an expert, I researched online and found the recovery expert , with the contact address- creditosantajusta@gmail.com OR Whatsapp +1(659) 210-0433 .I wrote directly to the specialist explaining my loss. Hence, he helped me recover my bitcoin just after 2 days. He helped me launch the recovery program , and the culprits were identified as well , all thanks to his expertise . I hope I have been able to help someone as well . Reach out to the recovery specialist to recover your lost funds from any form of online scam, he is dependable and trustworthy
0
Glad to chat your blog, I seem to be forward to more reliable articles and I think we all wish to thank so many good articles, blog to share with us.
cookie clicker
Schreibe einen Kommentar:
Themen:
iis css jquery asp.net-mvc html5 javascript asp.net csharp web .net
Entweder einloggen... ...oder ohne Wartezeit registrieren
Benutzername
Passwort
Passwort wiederholen
E-Mail
TOP TECHNOLOGIES CONSULTING GmbH