Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Msg 468, Level 16, State 9, Procedure "procedurename", Line 129 Cannot resolve the collation conflict between "Latin1_General_CI_AS" and... Expand / Collapse
Author
Message
Posted Thursday, September 19, 2013 2:15 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: 2 days ago @ 5:59 PM
Points: 8,748, Visits: 10,577
GOODS (9/19/2013)
Hi guys,

I'm have same issue:
Msg 468, Level 16, State 9, Procedure RPT_MTX_CDR_CostBreakdown_PerMsisdn, Line 142
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation.
I have the query below and my error massage is pointing at Line 142 and Line 142 is the SELECT DISTINCT.Please assist.

Select distinct ---------line 142
aa.Msisdn,
bb.box_no
into #MSISDNUnit
from #AllMSISDNCost aa
left join [10.24.4.56\EGHI].wasp_administration_SS.dbo.z_Unit_Lookup bb
on aa.MSISDN COLLATE DATABASE_DEFAULT = bb.MSISDN COLLATE DATABASE_DEFAULT
where bb.msisdn in (Select distinct msisdn from #AllMSISDNCost)
order by bb.box_no--24202

If you need to force the collation on the ON condition you also need to enforce it on the WHERE condition, as the columns involved are the same; so you could make it bb.MSISDN COLLATE DATABASE_DEFAULT in (Select distinct msisdn COLLATE DATABASE_DEFAULT from #AllMSISDNCost) .

Are you running with ANSI NULLs switched off, so that NULL in (select NULL) would deliver true?
Or are you working in a case sensitive system so that one (or both) of #AllMSISDNCost and z_Unit_Lookup has two columns, one called MSISDN and the other msisdn?

If neither of the above rather unusual things is true, do you think that filtering the result of left join on the equality condition by applying that where clause will produce something which would not be achieved by simplifying of the query to use an inner join and throwing away the where clause?


Tom
Post #1496582
Posted Friday, September 20, 2013 4:29 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, August 12, 2015 12:48 AM
Points: 50, Visits: 244
Thanks it worked..
Post #1496793
Posted Saturday, December 20, 2014 7:22 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, December 21, 2014 10:58 PM
Points: 2, Visits: 18
Hello,

I am looking for the resolution/clue for the error message I have been receiving since last 2-3 days.
Here is the scenario:

I have an .NET application where I am using SQL Server 2012 with Advanced Services x86 for database management. My development PCs have Windows 7 OS (one with 32-bit and other with 64-bit). The application is running as expected. I added one more PC with Windows 8 OS (64-bit) for testing purpose. I installed SQL Server 2012 with Advanced Services x64 on that PC. When I restored the database from Win7 pc to Win8 pc it got restored successfully in one go. On the database side, on both Win7 and Win8 pc, the database collation is set to the default type "SQL_Latin1_General_CP1_CI_AS"
Since past 2-3 days the application, when run on the Win8 pc, is giving me error for a particular stored procedure Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation. It happens only on Win8 pc. I have not used any collation directives while using joins or comparing column values. I have already rechecked and reset the collation type on both the PCs but the error still persists on the win8 pc.
I am wondering why is this happening only on Win8 pc?
Could this issue be related with SQL Server version on Win8 pc? If yes, what could be the resolution to the issue?
Please share your valuable thoughts.
Thanks in advance.
Post #1645653
Posted Saturday, December 20, 2014 3:36 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: 2 days ago @ 5:59 PM
Points: 8,748, Visits: 10,577
Amod Pusalkar (12/20/2014)
Hello,

I am looking for the resolution/clue for the error message I have been receiving since last 2-3 days.
Here is the scenario:
.....
On the database side, on both Win7 and Win8 pc, the database collation is set to the default type "SQL_Latin1_General_CP1_CI_AS"

It's a very long time since any release of MS SQL Server has had that default. The default has been Latin1_General_CI_AS for at least 6 years, and I believe for quite a bit longer. Obvioulsy if you are working with MS SQL Server 2012 you must have set the instance default to SQL_Latin1_General_CP1_CI_AS on installation of one or more of your systems, and left it at the default on one or more.
The solution is first to find out what each instances default collation is. Then change the default collation of whatever instances can be changed with least trouble. You may also have to change column collations explicitly for any tables created with a column or columns using the instance default collation. If you are lucky the database schema designers will have explicitly declared collations for all character type columns so that that won't be necessary (you could still get errors with temp tables and maybe with sql local variables, so ).

Sometimes the easiest way to change the default collation for an instance is to uninstall it and reinstall with the correct default collation, but you need to be very careful that you don't lose any data if you do it that way. The alternative is the Rebuild Master utlity (if it still exists - I haven't used in recent versions of SQL Server) but some people find that harder than the other way even when they have lots of data to preserve.


Tom
Post #1645712
Posted Sunday, December 21, 2014 1:36 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, December 21, 2014 10:58 PM
Points: 2, Visits: 18
TomThomson (12/20/2014)


It's a very long time since any release of MS SQL Server has had that default. The default has been Latin1_General_CI_AS for at least 6 years, and I believe for quite a bit longer. Obvioulsy if you are working with MS SQL Server 2012 you must have set the instance default to SQL_Latin1_General_CP1_CI_AS on installation of one or more of your systems, and left it at the default on one or more.
The solution is first to find out what each instances default collation is. Then change the default collation of whatever instances can be changed with least trouble. You may also have to change column collations explicitly for any tables created with a column or columns using the instance default collation. If you are lucky the database schema designers will have explicitly declared collations for all character type columns so that that won't be necessary (you could still get errors with temp tables and maybe with sql local variables, so ).

Sometimes the easiest way to change the default collation for an instance is to uninstall it and reinstall with the correct default collation, but you need to be very careful that you don't lose any data if you do it that way. The alternative is the Rebuild Master utlity (if it still exists - I haven't used in recent versions of SQL Server) but some people find that harder than the other way even when they have lots of data to preserve.


Hello Mr Tom,
Thanks for your quick reply.

While performing the installation of SQL Server 2012 Express on all afore-mentioned PCs I had kept the Collation type to whatever pre-filled value. I believe that value was "SQL_Latin1_General_CP1_CI_AS" so I thought it to be default for SQL Server. Also, I have checked the collation for model and tempdb databases and found that it was also "SQL_Latin1_General_CP1_CI_AS". There is no explicit collation specification for any column in any table hence it is "SQL_Latin1_General_CP1_CI_AS" for each column. If I am correct then the collation for database is preserved during the backup & restore activity and therefore on the destination server (if different than source) the server level collation and DB level collation can be different (I stand to be corrected by experienced members).
So in the mean while I am going to recheck all collation settings on each SQL instance once again.

--
Amod Pusalkar
Post #1645723
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse