Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Case Sensitive comparison, simple one!
Message
From
27/01/2006 14:18:06
 
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00637469
Message ID:
01091060
Views:
18
>
>You can do that by converting string values to binary
>IF CAST( 'ALLO' AS varbinary(10)) = CAST( 'Allo' AS varbinary(10))
> PRINT '=='
>ELSE
> PRINT '<>'
>

>
>Sergey, you provided that answer a few years ago and it helped some one. I was trying to figure out the same thing today, and figured a "Sergey Search" would give me the answer.
>
>You are THE MAN!
>
>Kevin

SORRY,

The conversion to varbinary is wrong.
IF 'ALLO' = 'ALLO '
SELECT 'same'
ELSE
SELECT 'diff'

IF CAST( 'ALLO' AS varbinary(10)) = CAST( 'ALLO ' AS varbinary(10))
SELECT 'same'
ELSE
SELECT 'diff'
use COLLATE
IF 'ALLO' = 'allo ' COLLATE Latin1_General_BIN
SELECT 'same'
ELSE
SELECT 'diff'
Previous
Reply
Map
View

Click here to load this message in the networking platform