Wednesday, April 26, 2017

UPPER() in SQL Server


SQL UPPER() function converts all the characters in the expression specified to uppercase. UPPER() is used to change the case of characters/letters to upper case. Non textual characters in the string are not affected the UPPER() function. If the characters are already in upper case, the same will be returned as output. UPPER() does not works on NULL Values, NULL values are not considered.


Syntax:

     
            SELECT UPPER(expression)
           

expression is the text whose case is to be changed to upper case.



Example 1:
UPPER() on numeric column.

SELECT * FROM TempEmployeePayHistory



SELECT Rate, UPPER(Rate) FROM TempEmployeePayHistory



Example 2:
UPPER() on column with NULL values.

          SELECT * FROM TempEmployeePayHistory



SELECT Rate, UPPER(Rate) FROM TempEmployeePayHistory



Example 3:
UPPER() on text column.

          SELECT * FROM DatabaseLog




          SELECT DISTINCT [Event], UPPER([Event]) FROM DatabaseLog


Share This
Previous Post
Next Post

TekGrabs, established in 2017, is in the business of sharing Information. It provides news, articles and photos about the different technologies, inventions in different domains. Provides information on programming and databases.

0 comments: