[RESOLVED] How to replace portion of string in field in table
Hello: I have a table that has a field called attachFilename
currently, all the records are poulated for this field with a string such as "\\companydrive\g-drive\company_TEST\Job_12\Job_12.dwg"
and I need to replace this portion of the string: "\\companydrive\g-drive\company_TEST" with a different string.
Is there an easy way to do this with sql?
I'm using sql express 2008.
thanks,
Proctor
Re: How to replace portion of string in field in table
Look into REPLACE
select replace('\\companydrive\g-drive\company_TEST\Job_12\Job_12.dwg','Company_TEST','with this')
Re: How to replace portion of string in field in table
Here is a better example:
Code:
create table #VBForums(MyText Varchar(200))
insert into #VBForums(mytext) values('\\companydrive\g-drive\company_TEST\Job_12\Job_12.dwg')
Update #VBForums
set MyText = replace('\\companydrive\g-drive\company_TEST\Job_12\Job_12.dwg','Company_TEST','with this')
where myText = '\\companydrive\g-drive\company_TEST\Job_12\Job_12.dwg'
select * from #VBForums
drop table #VBForums
Re: How to replace portion of string in field in table
That's awesome!! Thanks .......
Proctor