Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL SELECT

Author  Topic 

forefj
Starting Member

10 Posts

Posted - 2012-04-17 : 13:12:25
I need to change the letter case from a T-SQL SELECT OUTPUT.
I am Selecting FIRST NAME, LAST NAME and EMAIL ADDRESS.
The output I get back, for example is:
MIKE SMITH MSmith@email.com

I need to have it displayed as Proper case for Name and lower case for email, for example:
Mike Smith msmith@email.com

In Excel I can accomplish this with using =PROPER and =LOWER
However, I need to do this in SQL (Output only)
I can't change the data as it is stored in the database.
I have read about stored procs where you can change it in the database
but I haven't found a method to do it in the SELECT Output. Any ideas? Thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-17 : 13:28:44
why do you need to do this in sql?

why not use formatting functions at front end to achieve this?

if you've to do this in T-sql, you need to do something like

SELECT UPPER(LEFT(FIRSTNAME,1)) + LOWER(STUFF(FIRSTNAME,1,1,'')) AS FIRSTNAME,...
FROM table


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -