Tuesday, March 20, 2012

collation

hello,
i have to migrate and old schema into a new one.
i have the old table column with collation
Latin1_General_CI_AS
and the new table column with collation
Latin1_General_CP1_CI_AS
both columns are nvarchar
when i transfer the data i get the error
cannot resolve collation conflict for equal to operation
I do not understand this I read tens or hundreds of documentation
documentation says there is no conflict when unsing unicode types like
nvarchar.
but there is a conflict?
why and how can I solve it?
thank you.
michael
--
Michael ZdarskyThey aren't the same collation hence the message.
You can use the COLLATE option to cast the collation from one to another.
The 'n' in nvarchar just allows you to store double byte characters for
chinese etc... nothing to do with collation as such, its the fact its a
string data type that has a baring on the collation.
Tony.
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)|||hello tony
thank you for your answer,
yes they are different, but I compared the collation properties
codepage, lcid and comparison style and they are all identical.
so only the name is different, but there is still the problem.
how does the server compare this collations?
thank you
michael
"Tony Rogerson" wrote:

> They aren't the same collation hence the message.
> You can use the COLLATE option to cast the collation from one to another.
> The 'n' in nvarchar just allows you to store double byte characters for
> chinese etc... nothing to do with collation as such, its the fact its a
> string data type that has a baring on the collation.
> Tony.
> --
> Tony Rogerson
> SQL Server MVP
> http://www.sqlserverfaq.com?mbr=21
> (Create your own groups, Forum, FAQ's and a ton more)
>
>|||Hi Michael,
Seriously, they are different - one is a Windows collation and one SQL.
On the SQL Server set up you get the option of using a Windows collation or
SQL, one for backwards compatibility - can't remember which ones which now,
but this is where collation problems usually start.
Collation is horrible, the set-up doesn't really help you much either.
sp_helpsort can be used to get more information on the collation you are
using.
print cast( databasepropertyex( 'master', 'collation' ) as varchar(128) )
The above statement can be used to determine the database collation.
print cast( databasepropertyex( 'master', 'SQLSortOrder' ) as varchar(128) )
The above can be used to get the server sort id, which is what will differ.
Hope that helps.
Tony Rogerson
SQL Server MVP
http://www.sqlserverfaq.com?mbr=21
(Create your own groups, Forum, FAQ's and a ton more)sqlsql

No comments:

Post a Comment