all groups > sql server (alternate) > november 2005 >
You're in the

sql server (alternate)

group:

String case problem


String case problem vishal
11/29/2005 11:33:21 PM
sql server (alternate):
I am using a select statement like
SELECT ENAME FROM EMPTABLE WHERE ENAME ="vishal"

I am getting the result as 1 row affected.

Ename
----------
Vishal


The Problem is the query I have passed is "vishal"(lower case) and
getting the output as "Vishal"(V is Upper Case)

How do I solve this problem if I want to go with case sensitive
retrival of data.

I have gone thru some string functions available but could not find
one.
Any help would be appreciated..


regards
vishal.
Re: String case problem Jens
11/29/2005 11:54:35 PM

if you want to search CASE Sensitive you have to change the coallation
of your column / table or Query:

CS_AS means (C)ase (S)ensitive, (A)ccent (S)ensitive

SELECT ENAME FROM EMPTABLE WHERE ENAME COLLATE
SQL_Latin1_General_CP1_CS_AS ="vishal"


HTH, Jens Suessmeyer.
Re: String case problem MC
11/30/2005 12:00:00 AM
Check for the COLLATION in books online. Your setting is obviously CI (case
insensitive).
If you want just for the query to be case sensitive you can specify
collation in the select statement. Check for COLLATE option for this.


MC


[quoted text, click to view]

Re: String case problem m.bohse NO[at]SPAM quest-consultants.com
11/30/2005 1:23:11 AM
Another workaround I used in SQL 7.0 a lot would be:


SELECT ENAME FROM EMPTABLE
WHERE CONVERT (varbinar(255),ENAME ) = CONVERT(varbinary(255),
'vishal')

Markus
AddThis Social Bookmark Button