Solved

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

Posted on 2009-07-06
3
241 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
3 Comments
 
LVL 142

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now