Question

Comment créer un champ dans une instruction de sélection SQL en majuscules ou en minuscules?

Exemple:

sélectionnez le prénom de la personne

Comment faire en sorte que le prénom retourne toujours en majuscule et toujours en minuscule?

Était-ce utile?

La solution

SELECT UPPER(firstname) FROM Person

SELECT LOWER(firstname) FROM Person

Autres conseils

LCASE ou UCASE respectivement.

Exemple:

SELECT UCASE(MyColumn) AS Upper, LCASE(MyColumn) AS Lower
FROM MyTable

SQL SERVER 2005:

print upper('hello');
print lower('HELLO');

Vous pouvez utiliser fonction LOWER et fonction UPPER . Comme

SELECT LOWER('THIS IS TEST STRING')

Résultat:

this is test string

Et

SELECT UPPER('this is test string')

résultat:

THIS IS TEST STRING

Vous pouvez faire:

SELECT lower(FIRST NAME) ABC
FROM PERSON

REMARQUE: ABC est utilisé si vous souhaitez modifier le nom de la colonne

.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top