Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

formating in sql 2008

Posted on 2013-05-22
6
Medium Priority
?
202 Views
Last Modified: 2013-05-22
Hello,
I need to change the capitals from this
Lastname         Firstname
SMITH              KEITH KIRKWOOD
PHIPPS              OWEN CHARLES
BERENDSE       ANTONIA GERRANDINA
TAYLOR              DOREEN MARGARET
MURRELL              NANCY BERYL
TUSTIN              LILY

to this
Lastname         Firstname
Smith                Keith Kirwood
Phipps              Owen Charles
Berendse          Antonia Gerrandina
Taylor                Doreen Margaret
Murrell              Nancy Beryl
Tustin                Lily

The names are consistent I have over 5000 of them, they are in the fields
Lastname and Firstname on my customer table.

I am sure there is a script to do this
0
Comment
Question by:Amanda Walshaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 13

Accepted Solution

by:
Koen Van Wielink earned 2000 total points
ID: 39187021
Hi Flyfish,

This should work:

update	yourtable
set			firstname = Replace(Firstname,reverse(left(reverse(firstname),len(firstname)-1)),  reverse(lower(left(reverse(firstname),len(firstname)-1))))
		,	lastname = Replace(Lastname,reverse(left(reverse(Lastname),len(Lastname)-1)),  reverse(lower(left(reverse(Lastname),len(Lastname)-1))))

Open in new window


Best regards,

Kvwielink
0
 
LVL 13

Expert Comment

by:Koen Van Wielink
ID: 39187022
Hi Flyfish,

This should work:

update	yourtable
set			firstname = Replace(Firstname,reverse(left(reverse(firstname),len(firstname)-1)),  reverse(lower(left(reverse(firstname),len(firstname)-1))))
		,	lastname = Replace(Lastname,reverse(left(reverse(Lastname),len(Lastname)-1)),  reverse(lower(left(reverse(Lastname),len(Lastname)-1))))

Open in new window


Best regards,

Kvwielink
0
 
LVL 13

Expert Comment

by:Koen Van Wielink
ID: 39187023
Hi Flyfish,

This should work:

update	yourtable
set			firstname = Replace(Firstname,reverse(left(reverse(firstname),len(firstname)-1)),  reverse(lower(left(reverse(firstname),len(firstname)-1))))
		,	lastname = Replace(Lastname,reverse(left(reverse(Lastname),len(Lastname)-1)),  reverse(lower(left(reverse(Lastname),len(Lastname)-1))))

Open in new window


Best regards,

Kvwielink
0
Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

 
LVL 13

Expert Comment

by:Koen Van Wielink
ID: 39187026
Sorry about all the triple posts by the way, still haven't figured out how this happens. I'm pressing submit only once.
0
 

Author Comment

by:Amanda Walshaw
ID: 39187052
hmm anyway kvwielink it worked, I remembered after i sent the post, I need to take a break.
Thanks again.l
0
 

Author Closing Comment

by:Amanda Walshaw
ID: 39187054
excellent and too the point
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question