Using the LOWER() and UPPER() SQL Server Functions
Return rows for a column case insensitive
It is common practice to make a column case insensitive to ensure
that you return all of the desired rows.
SELECT *
FROM [dbo].[Courses]
WHERE LOWER(education_delivery_method) = 'classroom'
Display a column in uppercase
You can use either the SQL Server UPPER() or LOWER() functions to
format columns in your SQL SELECT.
SELECT TOP 10
UPPER(firstname),
lastname
FROM Students
Format a column using Upper and Lower functions
It is possible to use the SQL Server LOWER() and UPPER() functions in
conjunction with the SUBSTRING() function to accomplish different types
of formatting.
SELECT TOP 10
UPPER(SUBSTRING(lastname,1,1)) + LOWER(SUBSTRING(lastname,2,29))
AS 'Lastname'
FROM Students
Update a group of rows changing case
It is possible to use the SQL Server UPPER() or LOWER() functions in
conjunction with an update statement to change the "case" of a
group of rows.
BEGIN TRANSACTION
GO
UPDATE [dbo].[Students]
SET lastname = UPPER(lastname)
WHERE student_id > 0
GO
COMMIT TRANSACTION
GO
If you find this site useful and are a book buyer/reader...
You can support my site by clicking on one of the Links below to Abe books
By doing this, I will receive a small commision on your purchase and making your purchase
will not cost you any more money than if you went directly the site yourself!
Abe Books sells books at a fraction of the original cost. I
have purchased many books from them originally cost $40.00 for as little as $5 to $10 dollars
including shipping costs
Click on applicable icon to find books at Abe Books on ...
|
| SQL Server 2008 |
SQL Server 2005 |
SQL Server 2000 |
T-SQL |
|
|
|
|
|
|
Abe Books is one of my affiliates. I only use affiliates that I also
purchase products from. I love Abe books. If it is printed they likely
have a copy. I have also included a generic link to Abe Books below.
Once on their site, you will find that they have a nice, easy to use search engine so
to find what you are looking for. |

|