UCASE() and LCASE() Function in SQL
The UCASE() function converts the value of a field to uppercase.
The LCASE() function converts the value of a field to lowercase.
Syntax:-
Now, we are using SQL SERVER. So, first of all we create table tblProduct and insert some products as shown in belwo.
Example(1):-
Example(2):-
The LCASE() function converts the value of a field to lowercase.
Syntax:-
--------------UCASE() Syntax--------------- SELECT UCASE(column_name) FROM table_name --------------LCASE() Syntax--------------- SELECT LCASE(column_name) FROM table_name -------------------OR--------------------- SELECT LOWER(column_name) FROM table_name
Now, we are using SQL SERVER. So, first of all we create table tblProduct and insert some products as shown in belwo.
CREATE TABLE tblProduct ( ProductId int primary key,ProductName varchar(100),Quantity int, Price int,SupplierId int ) ----------Insert some record---------- INSERT INTO tblProduct VALUES(1001,'Product1',10,2000,1) INSERT INTO tblProduct VALUES(1002,'Product2',20,9000,2) INSERT INTO tblProduct VALUES(1003,'Product3',12,1200,2) INSERT INTO tblProduct VALUES(1004,'Product4',9,200,3) INSERT INTO tblProduct VALUES(1005,'Product5',25,1000,4) INSERT INTO tblProduct VALUES(1006,'Product6',30,300,4) INSERT INTO tblProduct VALUES(1007,'Product7',5,2000,1) INSERT INTO tblProduct VALUES(1008,'Product8',18,4000,5) INSERT INTO tblProduct VALUES(1009,'Product9',10,5000,6)
Example(1):-
SELECT UPPER(ProductName) AS ProductName FROM tblProduct
Example(2):-
SELECT LOWER(ProductName) AS ProductName FROM tblProduct