Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Case

Status
Not open for further replies.

Francelino

Programmer
May 15, 2002
6
BR
Hi.

How i can execute a query in PostgreSQL with, case
insensitive and accent insensitive.

Thank's.

Ass.: Fabio Alves Francelino
 
PostgreSQL keywords, table names, and column names are case-insensitive by default, unless you put quote delimiters around them:
Code:
seLeCt "TableName"."ColumnName", "tablename"."columnname" FROM "TableName", "tablename" ordEr By "tablename"."columnname" aSc;

You could even have a table or column called "Select", if you always put it inside quotes, to differentiate it from SQL SELECT.

See for more info. -------------------------------------------

"Now, this might cause some discomfort..."
(
 
You don't understand.

The case is in data into a table.

Example:
Select * from
Where [collum] like 'a%'.

This query must return the records:
A...* return
a...* no return
Á...* no return

I found in help the operator ~~* that works.

Example:
Select * from
Where [collum] ~~* 'a%'.
A...* return
a...* return
Á...* return

But i don't want replace the like operator.

I ask for a solution that works for all queries with like operator.

How a propertie that you set in Server PostGreSQL.

How in the instalation of SQL Server.

Any way thank you

Ass.: Fabio Alves Francelino
 
For case-insensitive LIKE comparisons, just use the ILIKE operator. (see I don't know if that would work with accented characters, though, so you might have to keep working with regular expressions.

Also, you can cast any string result to lower-case or upper-case, if you want (
Code:
Select * from [Table] Where lower([column]) like 'a%';
Select * from [Table] Where upper([column]) like 'A%';

-------------------------------------------

"Now, this might cause some discomfort..."
(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top