Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Collation

Author  Topic 

hameedf
Starting Member

27 Posts

Posted - 2012-07-10 : 08:44:33
Hello experts !


I am in problem my all db views works fine but few views when i select top 1000 rows from sql having error


Msg 468, Level 16, State 9, Procedure zh_CN, Line 135
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CS_AS" and "Latin1_General_CS_AS" in the equal to operation.
Msg 4413, Level 16, State 1, Line 117
Could not use view or function 'PET.dbo.zh_CN' because of binding errors.



Please help




Hameed

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2012-07-10 : 10:10:54
>>Could not use view or function 'PET.dbo.zh_CN' because of binding errors.
This refers to the fact that at least one of the underlying tables in this view has been modified since the view was created. A column renamed or dropped. Fix the view definition then compile it.

>>Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CS_AS" and "Latin1_General_CS_AS" in the equal to operation
This refers to some correlation you are using in a your statement where one of the columns being correlated is of a different collation then the other. Assuming the different collations are intentional then you can correct that by specifying the collation in the correlation:

a.col = b.col collate SQL_Latin1_General_CP1_CS_AS

EDIT:
if the collation difference is not intentional then you would need to ALTER TABLE <table> ALTER COLUMN <column> <datatype> [not] null collate <collation>

Be One with the Optimizer
TG
Go to Top of Page

xhostx
Constraint Violating Yak Guru

277 Posts

Posted - 2012-07-10 : 10:12:57
hi,


check out this blog please, it is helpful.

luck

http://blog.sqlauthority.com/2008/12/20/sql-server-change-collation-of-database-column-t-sql-script/

--------------------------
Get rich or die trying
--------------------------
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-10 : 10:26:18
you can always override collation at runtime using COLLATE clause. just use COLLATE DATABASE_DEFAULT at the places you do varchar column comparison between the tables

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2012-07-10 : 10:46:35
quote:
Originally posted by visakh16

you can always override collation at runtime using COLLATE clause. just use COLLATE DATABASE_DEFAULT at the places you do varchar column comparison between the tables


Unless of course you need to override the default db collation for a given correlation which is why I included COLLATE clause above with a specific collation.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -