Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to retrieve lower case columns record

Author  Topic 

micnie_2020
Posting Yak Master

232 Posts

Posted - 2010-04-19 : 22:30:22
Dear All,

TableA
---------

Name Code
A 123bhg71
B AB788H
C 778899
D vt78892


Output needed
--------------

A & D Only



*********************************

SQL Statement Below only can give me up to this result

A, B & D.

SELECT Names
FROM TableA
WHERE Code LIKE '%[a-z]%'

*********************************************

I can't proceed of checking of case sensitive. Anyone can help me??
Thank you.


Regards,
Micheale

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-20 : 00:52:12
if you want to make case sensitive check make sure you use a case sensitive collation

http://www.mssqltips.com/tip.asp?tip=1032

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

micnie_2020
Posting Yak Master

232 Posts

Posted - 2010-04-20 : 01:36:03
Dear Sir,

If i don't have collation case sensitive, what other method can be used to trace out all the column contain lower case value??

Please Advise.

Regards,
Micheale
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-04-20 : 03:37:46
SELECT Names
FROM TableA
where cast(code as varbinary(100))=cast(lower(code) as varbinary(100))
and code like '%[a-z]%'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-20 : 09:36:05
quote:
Originally posted by micnie_2020

Dear Sir,

If i don't have collation case sensitive, what other method can be used to trace out all the column contain lower case value??

Please Advise.

Regards,
Micheale


nope you can still force case sensitive collation while searching using COLLATE. see solution in link posted earlier

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -