HI I have a database with a string as one of the fields and I need to modify
only a portion of the string. For example below is a record in the database
old string
server1/folder1
want to change to
server2/folder1
--
Paul G
Software engineer.REPLACE is one good option. Here is an example:
create table #test111
(scode int,
sdesc varchar(30))
insert into #test111 values (1,'server1/folder1')
insert into #test111 values (2,'server1/folder1')
update #test111 set sdesc = replace(sdesc,'server1/','server2/')
where scode = 1
select * from #test111
"Paul" wrote:
> HI I have a database with a string as one of the fields and I need to modify
> only a portion of the string. For example below is a record in the database
> old string
> server1/folder1
> want to change to
> server2/folder1
> --
> Paul G
> Software engineer.|||ok thanks for the information
--
Paul G
Software engineer.
"Absar Ahmad" wrote:
> REPLACE is one good option. Here is an example:
> create table #test111
> (scode int,
> sdesc varchar(30))
> insert into #test111 values (1,'server1/folder1')
> insert into #test111 values (2,'server1/folder1')
> update #test111 set sdesc = replace(sdesc,'server1/','server2/')
> where scode = 1
> select * from #test111
> "Paul" wrote:
> > HI I have a database with a string as one of the fields and I need to modify
> > only a portion of the string. For example below is a record in the database
> >
> > old string
> > server1/folder1
> > want to change to
> > server2/folder1
> > --
> > Paul G
> > Software engineer.
没有评论:
发表评论