Solved

Is it possible to alter varchar  data in a SQL database?

Posted on 2009-07-06
3
297 Views
Last Modified: 2012-05-07
Hi I have a database to is storing names in a table I.e customer table with the field both the first and lastnames are stored in this like peter pan. I have recently added a form that captures the username I.e as peter.pan is there a way to run a SQL statment that will alter only peter.pan like data and reformat to peter pan? Let me know if you require any additonal info. Thanks Adrian
0
Comment
Question by:adypips
[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
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 24784168
you mean
UPDATE yourtable
   SET yournamefield = REPLACE(yournamefield, '.', ' ')
 WHERE yournamefield LIKE '%.%'

Open in new window

0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24784178
Hope this is what you meant:

update ur_table
set name =  replace(name, '.', ' ')

Kindly tell me if this doesn't helped you out with examples so that I can help further
0
 

Author Closing Comment

by:adypips
ID: 31600111
Many thanks spot on, this exactly what I am after. Many thanks
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

705 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