SQL Server - Convert varchar to another collation (code page) to fix character encoding

前端 未结 4 1728
自闭症患者
自闭症患者 2021-01-01 12:46

I\'m querying a SQL Server database that uses the SQL_Latin1_General_CP850_BIN2 collation. One of the table rows has a varchar with a value that includes the +/- character

4条回答
  •  余生分开走
    2021-01-01 13:33

    Must be used convert, not cast:

    SELECT
     CONVERT(varchar(50), N'æøåáäĺćçčéđńőöřůýţžš')
     COLLATE Cyrillic_General_CI_AI
    

    (http://blog.sqlpositive.com/2010/03/using-convert-with-collate-to-strip-accents-from-unicode-strings/)

提交回复
热议问题