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 2000 Forums
 SQL Server Development (2000)
 query with no case

Author  Topic 

dignam
Starting Member

4 Posts

Posted - 2002-08-29 : 10:05:22

How can I query a field with no case?

For example

value in the table = "APPLES and oranges"

SELECT fieldname
FROM table
WHERE value = "apples and oranges"

returns 0 records.

We don't want to convert all characters to uppercase for
the comparison.

any help at all greatly appreciated

- Jeffrey

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2002-08-29 : 11:03:56
This assumes SQL7 being used...


SELECT LOWER(fieldname)
FROM table
WHERE value = "apples and oranges"

Paul

Edited by - KnooKie on 08/29/2002 11:05:20
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-08-29 : 18:27:46
Paul, didn't you mean to put the LOWER() in the WHERE clause?

SELECT fieldname
FROM table
WHERE LOWER(value) = 'apples and oranges'

P.S. to Jeffrey, in SQL you are MUCH better off using single quotes around strings instead of double quotes.

Go to Top of Page
   

- Advertisement -