Showing posts with label sensitiveselect. Show all posts
Showing posts with label sensitiveselect. Show all posts

Monday, March 26, 2012

query where Case sensitive

hi, how to write query is Case sensitive?
select * from tb where fd like '%Temp'
will only return not "temp" ones? Thanks.Youcan explicitly define the collation for the query comparison:
select * from tb where fd like '%Temp' COLLATE
SQL_Latin1_General_CP1_CS_AS
CS which means "Case Sensitive"
HTH, jens Suessmeyer.|||Hi
Here are some examples
create table ABCD
(
courceid smallint not null,
description varchar(20) null
)
insert into ABCD(courceid,description)values (1,'DFh2AcZ')
insert into ABCD(courceid,description)values (2,'dHZ3')
)
SELECT description FROM ABCD where charindex(cast('H' as
varbinary(20)),cast(description as varbinary(20)))> 0
SELECT description
FROM ABCD
WHERE description ='dhZ3'COLLATE Latin1_General_BIN
SELECT description
FROM ABCD
WHERE charindex('h',description COLLATE Latin1_General_BIN)>0
--for sql2000
SELECT *
FROM Authors
WHERE au_lname COLLATE Latin1_General_CS_AS = 'green' COLLATE
Latin1_General_CS_AS
AND au_lname = 'green'
"js" <js@.someone.com> wrote in message
news:uxEv$ciNGHA.2920@.TK2MSFTNGP10.phx.gbl...
> hi, how to write query is Case sensitive?
> select * from tb where fd like '%Temp'
> will only return not "temp" ones? Thanks.
>