Re: How do i perform a case sensitive search??
From: Anith Sen (anith_at_bizdatasolutions.com)
Date: 09/27/04
- Next message: Anith Sen: "Re: SUBSTRING question"
- Previous message: Skip: "SUBSTRING question"
- In reply to: Michael: "How do i perform a case sensitive search??"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 27 Sep 2004 11:17:40 -0500
You can use COLLATE clause with a case sensitive collation, cast the value
to a binary type or use a CHECK_SUM comparison ( in trivial cases ). For
example you can have your query like:
SELECT *
FROM members
WHERE user_ = 'abc'
AND password_ COLLATE SQL_Latin1_General_CP1_CS
= 'AbCd' ;
You can get a list of valid collation names for Windows & SQL using:
SELECT *
FROM ::fn_helpcollations()
For smaller strings you can use another method where you convert the string
value to a binary type like :
SELECT *
FROM members
WHERE user = 'abc'
AND CAST( password_ AS VARBINARY )
= CAST( 'AbCd' AS VARBINARY )
Read through the topics related to COLLATE and CAST & CONVERT for
explanations & examples of using CAST/CONVERT functions as well as the exact
syntax details. Also, just wanted to add, using reserved words like
"password" for column names is not generally a good idea.
-- Anith
- Next message: Anith Sen: "Re: SUBSTRING question"
- Previous message: Skip: "SUBSTRING question"
- In reply to: Michael: "How do i perform a case sensitive search??"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|