Reputation: 2217
How do you make a field in a sql select statement all upper or lower case?
Example:
select firstname from Person
How do I make firstname always return upper case and likewise always return lower case?
Upvotes: 63
Views: 205427
Reputation: 4492
You can use LOWER function
and UPPER function
. Like
SELECT LOWER('THIS IS TEST STRING')
Result:
this is test string
And
SELECT UPPER('this is test string')
result:
THIS IS TEST STRING
Upvotes: 2
Reputation: 498
You can do:
SELECT lower(FIRST NAME) ABC
FROM PERSON
NOTE: ABC
is used if you want to change the name of the column
Upvotes: 0
Reputation: 37839
LCASE or UCASE respectively.
Example:
SELECT UCASE(MyColumn) AS Upper, LCASE(MyColumn) AS Lower
FROM MyTable
Upvotes: 16
Reputation: 8610
SELECT UPPER(firstname) FROM Person
SELECT LOWER(firstname) FROM Person
Upvotes: 101