Skip to content
Advertisement

Why collation doesn’t work with for xml path in subquery?

I usually use collate SQL_Latin1_General_CP1251_CI_AS to remove accents (diacritics) like this.

escrzyaie-escrzyaie

Unfortunately, after one of the search queries stopped working, I found out that collation is ignored when used in combination with for xml path in subquery.

ěščřžýáíé-ěščřžýáíé

It is possible to work around this by using collation for each part separately, but I wonder why it doesn’t work in the previous example.

escrzyaie-escrzyaie

Advertisement

Answer

Cast it to varchar before concatenating

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement