Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Mass Update of a string

Author  Topic 

btamulis
Yak Posting Veteran

64 Posts

Posted - 2010-03-19 : 14:05:10
Is there an easy way in sql transact to accomplish the following:

Table has a column which contains a string such as:

C:\GP\Images\Bike_Model001.jpg

The table has over a 1,000 records.

I want to mass update all records by replacing the 'GP' with Pictures.

After update the column should read:

C:\Pictures\Images\Bike_Model001.jpg

Basically I need to update a portion of the string value.

Any thoughts?

Thank you in advance.....

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-19 : 14:13:32
UPDATE Table
SET Column=REPLACE(Column,'\GP\','\Pictures\')

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

btamulis
Yak Posting Veteran

64 Posts

Posted - 2010-03-19 : 14:39:49
Thanks - works like a champ.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-20 : 01:39:21
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -