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?
From stackoverflow
-
LCASE or UCASE respectively.
Example:
SELECT UCASE(MyColumn) AS Upper, LCASE(MyColumn) AS Lower FROM MyTable
Joshua Hudson : Is this for mysql?Joshua Hudson : UCASE for lower and LCase for Upper?Stephen Wrighton : @Joshua - LCASE & UCASE are inherent within the SQL language itself not related to any specific implementation of SQL within a RDBMS. And I fixed the UCASE/LCASE for Lower/Upper thing.Joshua Hudson : Thank you. I gave you a up vote because you are right about ISO SQL vs an implementation. -
SQL SERVER 2005:
print upper('hello'); print lower('HELLO');
Joshua Hudson : Perfect. Thank you Cirieno! I actually had this answer but wanted it to be documented on stack overflow since I only use this rarely I always forget it. :) -
SELECT UPPER(firstname) FROM Person SELECT LOWER(firstname) FROM Person
Joshua Hudson : I'm giving Jared the answer since this is closer to my asked question.
0 comments:
Post a Comment