Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do use use COLLATE for search_condition in WHERE clause?

Status
Not open for further replies.

edoherty

Programmer
Oct 1, 2002
28
0
0
US
I've used the COLLATE clause for an expression in the WHERE clause of a SELECT statement. For example, when comparing 2 tables that contain a unique id that's case sensitive:

SELECT...
FROM...
WHERE sdo1.SDO_Unique_Id *= sdo2.SDO_Unique_Id COLLATE SQL_Latin1_General_CP1_CS_AS


But how do I use it when using a search_condition:

SELECT...
FROM...
WHERE SDO_Unique_Id NOT IN (SELECT SDO_Unique_Id
FROM TPEHQSQL02.TPECommon.dbo.SOD_Sales_Order_Details)

Any assistance would be greatly appreciated!!!

Thx

 
Doesn't

Code:
SELECT...
FROM...
WHERE   SDO_Unique_Id COLLATE SQL_Latin1_General_CP1_CS_AS
NOT IN (SELECT    SDO_Unique_Id
COLLATE SQL_Latin1_General_CP1_CS_AS
    FROM TPEHQSQL02.TPECommon.dbo.SOD_Sales_Order_Details)

work?

Another way to get case sensitivity is to cast the operands to binary.
 
Thank you, that worked!

I made a few attempts @ syntax similar to this, but missed this somehow.

Thx again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top