how to print last character as to be in upper case and remainig characters has to be

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Harish Reddy
    New Member
    • Nov 2017
    • 1

    how to print last character as to be in upper case and remainig characters has to be

    i need to print last character in a word as upper case and remaining characters has to be in lower case
    for example :
    company is my word
    i need to print it as companY
  • Uncle Dickie
    New Member
    • Nov 2008
    • 67

    #2
    Use a combination of the UPPER and LOWER functions e.g.

    Code:
    DECLARE	@text as varchar(5)
    SET	@text = 'Hello'
    
    SELECT	lower(left(@text,LEN(@text)-1)) + UPPER(RIGHT(@text,1))

    Comment

    Working...