SQL changing a value to upper or lower case

后端 未结 5 922
一生所求
一生所求 2021-02-02 05:39

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 up

相关标签:
5条回答
  • 2021-02-02 05:43
    SELECT UPPER(firstname) FROM Person
    
    SELECT LOWER(firstname) FROM Person
    
    0 讨论(0)
  • 2021-02-02 05:49

    LCASE or UCASE respectively.

    Example:

    SELECT UCASE(MyColumn) AS Upper, LCASE(MyColumn) AS Lower
    FROM MyTable
    
    0 讨论(0)
  • 2021-02-02 05:51

    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
    
    0 讨论(0)
  • 2021-02-02 05:51

    You can do:

    SELECT lower(FIRST NAME) ABC
    FROM PERSON
    

    NOTE: ABC is used if you want to change the name of the column

    0 讨论(0)
  • 2021-02-02 06:07

    SQL SERVER 2005:

    print upper('hello');
    print lower('HELLO');
    
    0 讨论(0)
提交回复
热议问题