?
Solved

how to replace text within a string of a specified column

Posted on 2011-02-19
3
Medium Priority
?
266 Views
Last Modified: 2012-08-13
How can I replace a string "2011-02-05" (right 10 characters) in every row of my column called unique?  I need to replace this with "2011-01-29' .  Not every field has the same number of characters.

0
Comment
Question by:kat50
[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
  • 2
3 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 total points
ID: 34934005
UPDATE SomeTable
SET SomeColumn = REPLACE(SomeColumn, '2011-02-05', '2011-01-29')
WHERE CHARINDEX('2011-02-05', SomeColumn) > 0
0
 
LVL 93

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 2000 total points
ID: 34934010
To work specifically on the right 10 chars...

UPDATE SomeTable
SET SomeColumn = SUBSTRING(SomeColumn, 1, LEN(SomeColumn) - 10) + '2011-01-29'
WHERE SomeColumn LIKE '%2011-02-05'
0
 

Author Closing Comment

by:kat50
ID: 34934013
Thank you
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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

765 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