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
 General SQL Server Forums
 New to SQL Server Programming
 case insensitive

Author  Topic 

shree_uday
Starting Member

2 Posts

Posted - 2010-05-10 : 12:39:16
Hi to all sql gurus,

I want to display the all the reocrds without considering the case. for an eg.if there is record have the value called "test", if i give the value as "test", or "TEST" or TEst or teST and etc...it will display the all record have the value "test". kindly help me out.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-10 : 12:44:35
What collation are you using? If you are using a case insensitive collation, like the default, then test == TEST. If you want to display them in lower case, then you can use the LOWER function (or handle the display in your application).

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-10 : 12:58:45
just apply a case insensitive collation like

SQL_Latin1_General_CP1_CI_AS

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

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-10 : 13:00:49
Well let's determine if that's even needed first.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-05-10 : 13:01:00
I would apply the same collation as currently used but substitute CS (Case Sensitive) for CI (Case Insensitive) - that should retain the accent / language collation aspects.
Go to Top of Page

shree_uday
Starting Member

2 Posts

Posted - 2010-05-10 : 13:15:14
thanks for the reply.. actually im working in sql navigator...i want to excute the table with all possiblities of case value...suppose if the record having the value called test. when i give the values like teST or TEST or TEst or test when i execute... it will display all the records having the value called "test".
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-10 : 13:20:07
quote:
Originally posted by shree_uday

thanks for the reply.. actually im working in sql navigator...i want to excute the table with all possiblities of case value...suppose if the record having the value called test. when i give the values like teST or TEST or TEst or test when i execute... it will display all the records having the value called "test".


then wat i suggested is enough.
just do like

WHERE yourcol COLLATE <case sensitive collation> = 'test'

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

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-05-10 : 13:22:08
Have you checked what Collation the column uses as requested above?

As stated above, IF the field is defined with a case INSensitive collation then comparing the record with "Test" "TEST" or "test" will all be TRUE.

IF the collation defined on the field is Case SENSITIVE then the comparison will only be true if the correct case is used. In that case you need to force the collation (to use a Case INSensitive collation just for your comparison test) as described above
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-05-10 : 13:24:16
@Visakh: Typo? "WHERE yourcol COLLATE <case INsensitive collation> = 'test'" ?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-10 : 13:26:28
quote:
Originally posted by Kristen

@Visakh: Typo? "WHERE yourcol COLLATE <case INsensitive collation> = 'test'" ?


oops yeah nice catch

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

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-10 : 13:29:16
quote:
Originally posted by shree_uday

actually im working in sql navigator



SQL Navigator is an Oracle product, so I don't think we'll be able to help shree_uday.

shree_uday, you should post your question on a site that deals with Oracle since this site is for Microsoft SQL Server. Try dbforums.com or orafaq.com, you should be able to find help there.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -