473,804 Members | 3,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sql Cannot resolve collation conflict equals - comparing rows and fileds between Table1 and View1

Yas
Hello,

I currently have Table1 and View1.

View1 is a query from 2 or 3 tables that works fine on its own.

However in my current query if I try to use it...something like...

SELECT a.col1, a.col2, a.col3, b.col1, b.col2, b.col3
FROM View1 a JOIN Table1 b on a.col1 = b.col1
WHERE a.col2 <b.col2 OR a.col3 <b.col3
It throws an error "Server: Msg 446, Level 16, State 9, Line 1 Cannot
resolve collation conflict for not equal to operation."

Clearly I need to use collation between Table1 and View1, But I dont
know where I need to use "COLLATE SQL_Latin1_Gene ral_CP850_CI_AI " and
how? this is the collation set on Table1.
Thank you!

Yas

Jun 27 '07 #1
1 4405
Yas (ya****@gmail.c om) writes:
I currently have Table1 and View1.

View1 is a query from 2 or 3 tables that works fine on its own.

However in my current query if I try to use it...something like...

SELECT a.col1, a.col2, a.col3, b.col1, b.col2, b.col3
FROM View1 a JOIN Table1 b on a.col1 = b.col1
WHERE a.col2 <b.col2 OR a.col3 <b.col3
It throws an error "Server: Msg 446, Level 16, State 9, Line 1 Cannot
resolve collation conflict for not equal to operation."

Clearly I need to use collation between Table1 and View1, But I dont
know where I need to use "COLLATE SQL_Latin1_Gene ral_CP850_CI_AI " and
how? this is the collation set on Table1.
For instance:

SELECT a.col1, a.col2, a.col3, b.col1, b.col2, b.col3
FROM View1 a
JOIN Table1 b on a.col1 COLLATE SQL_Latin1_Gene ral_CP850_CI_AI = b.col1
WHERE a.col2 COLLATE SQL_Latin1_Gene ral_CP850_CI_AI <b.col2
OR a.col3 COLLATE SQL_Latin1_Gene ral_CP850_CI_AI <b.col3

You only need the COLLATE clause for character columns, so if any of these
are for instance int, you can skip the COLLATE clause for these.

What collation are the other columns? If they are of a different code
page than CP850 and you are using varchar, there could be unepxected results
due to character conversions.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
5163
by: NickName | last post by:
I have the following situation. One set of data has 274 rows (set2) and anther has 264 (set1). Both data sets are similar in structure as well as values for both of them were extracts from the same parent table. Hope the info would substitute DDL. I need to find the "gap" rows between these two sets. Attempted to run a query like select count(*) from set2 where not exists (select *
3
4788
by: ambersaria420 | last post by:
Hi All, I need to help with converting rows to columns in SQL2k. Input: Id Name Role 58 Ron Doe Associate 58 Mark Bonas Doctor 59 Mike Johnson Doctor
1
1812
by: John Jayaseelan | last post by:
Hi, The tempdb db is having different collation than the application db. I rebuilt the master db with the appropriate collation after backing up master, model, msdb, appln databases. On restore of the databases (master, model, msdb, appln) from the backup restores the backed up database collation.
9
3753
by: Steve Jorgensen | last post by:
Hi all, Frankly, this is such an off-beat thing, I don't know if anyone else here will ever have the same issue. Just in case anyone does, though... I needed to be able to search for the first string in a recordset that is the same as a specified string value, or the one that would be right after that if it doesn't exist. Several searches per second may occur, so I needed to search within the recordset first, and only query the...
7
85153
by: Ryan | last post by:
I've stumbled across the above error and am a little stuck. I've just installed SQL2000 (sp3) on my PC and restored a database from our Live server. On a simple Update statement on a #temp table, it fails with the above message. I think I understand what it means and found some old posts suggesting using the following : select name, databasepropertyex(name, 'collation') from master..sysdatabases select serverproperty('collation')
21
28052
by: Peter Nurse | last post by:
I have just upgraded to SQL Server 2005 from SQL Server 2000. In Microsoft SQL Server Management Studio, when I click on database properties, I receive the following error:- Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. (Microsoft SQL Server, Error: 468)
1
1423
by: razaqtelecom | last post by:
Hi, I want to know how can i write a stored procedure for the following sceario. Take if there are three tables, table1, table2, table3 and table1 is linked with table2 and table 2 is linked with table3. Now i have to compare a data in table 3 for one of the rows in table1 where as For the same row in table1 there will 100 rows in table 2 and for each row in table2 there will be 100 rows in table 3. So I need to write a stored...
5
14561
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I am trying to get the DNS name of an arbitrary IP address on the network. If I use GetHostEntry as the documentation suggests I only get the name of the machine I am running the code on. All other IP’s returns the IP in the HostName property of the IPHostEntry object returned by GetHostEntry. If I use Dns.GetHostByAddress or Dns.Resolve I get the name, but these are marked as obsolete. What is the correct way to get this...
2
6147
Uncle Dickie
by: Uncle Dickie | last post by:
Hi All, I am getting the error: Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation. when I run a query I have written. The SQL I have written is pretty long (I can post it if needed but don't want to confuse things too much!), but basically it goes something like this: Create temporary table #temp1. Insert Into #temp1 (x 2)
0
9575
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10320
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10308
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10073
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.