?
Solved

How to update part of a sql field

Posted on 2008-10-20
2
Medium Priority
?
639 Views
Last Modified: 2012-06-22
Say I have the following rows in my DB table

19.28      Windows200364      \\machine1\Drivers\aaa\      3/5/2007 2:04:27 PM      storage      930
19.28      Windows200332      \\machine1\Drivers\aaa\      3/5/2007 2:04:25 PM      storage      775

All I want to do is change the machine1 in the third column to machine2 so i end up with

19.28      Windows200364      \\machine2\Drivers\aaa\      3/5/2007 2:04:27 PM      storage      930
19.28      Windows200332      \\machine2\Drivers\aaa\      3/5/2007 2:04:25 PM      storage      775

Basically just a partial search and replace.
I have NO idea how to go about this.
0
Comment
Question by:Matt_Du
[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 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 260 total points
ID: 22763783
UPDATE SomeTable
SET MachineName = REPLACE(MachineName, '\\machine1\', '\\machine2\')
WHERE MachoneName LIKE ''\\machine1\%'
0
 
LVL 6

Assisted Solution

by:llman
llman earned 240 total points
ID: 22763840
UPDATE DbTable SET Col3 = REPLACE(Col3, 'machine1', 'machine2')

replace DbTable and Col3 with your table name and column name
0

Featured Post

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 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