Home > Archive > MS SQL Server > November 2005 > any easy way to modify string in dbase









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author any easy way to modify string in dbase
Paul

2005-11-29, 11:23 am

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.
Absar Ahmad

2005-11-29, 1:23 pm

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,'serve
r1/','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.

Paul

2005-11-29, 1:23 pm

ok thanks for the information
--
Paul G
Software engineer.


"Absar Ahmad" wrote:
[color=darkred]
> 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,'serve
r1/','server2/')
> where scode = 1
>
> select * from #test111
>
> "Paul" wrote:
>
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com