sql - Keep characters between collations -


im using sql server 2012. have issue have 1 database uses danish_norwegian_ci_as.

i have polish characters(and in future many other languages) shows differently.

for example if have these characters:

żśąółćęźę

it shows in database:

zsaólceze

the problem can't change collation(long story, shortly due compatibility issues).

i have column named address2 (varchar) in customers table.

in update statement tried:

update customers set address = n'żśąółćęźę'  customerid = 'mycustomerid' 

it still shows incorrect output if use n between value.

i have tried create column data type nvarchar , seems work perfectly. want avoid this.

well, can't. collations affect not comparing , sorting strings, way characters stored, have found out yourself. option create column proper collation or change datatype nvarchar.

see sample:

create database ct collate polish_ci_as; go use ct; go  -- difference here? select cast('żśąółćęźę' varbinary) use master; go select cast('żśąółćęźę' varbinary) go  use ct; declare @t table  (c1 varchar(1000) collate danish_norwegian_ci_as, c2 nvarchar(1000) collate danish_norwegian_ci_as, c3 varchar(1000) collate polish_ci_as, c4 nvarchar(1000) collate polish_ci_as)  insert @t values ('żśąółćęźę', 'żśąółćęźę', 'żśąółćęźę', 'żśąółćęźę')  select * @t 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -