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
 General SQL Server Forums
 New to SQL Server Programming
 SQL Query

Author  Topic 

stevehatdc
Starting Member

2 Posts

Posted - 2007-08-31 : 15:06:36
I'm rather new to sql and I'm try to make a query. I'm trying to get the query to find all records in a column that have "P:\" (3 characters in from left) and replace it with "\\schmssql01\photos\". The table is called PC_DOC_LOCATOR and the column is called PATH_EXTERNAL, and an example of a record is "p:\pix\s\a\sa085031.jpg". Ultimately, I'd like to change this record, and others similar to it, to "\\schmssql01\photos\pix\s\a\sa085031.jpg" Does anyone have a suggestion for a query that would replace the p:\ with the \\schmssql01\photos'?

Thanks.

Steve H

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-31 : 15:16:33
UPDATE Table
SET Col1 = '\\schmssql01\photos\' + stuff(Col1, 1, 3, '')
WHERE Col1 LIKE 'p:\%'



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

stevehatdc
Starting Member

2 Posts

Posted - 2007-08-31 : 16:09:15
That worked perfectly. Thanks!
Go to Top of Page
   

- Advertisement -