|
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
|
|
|
| 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.
| |
|
| 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:
>
|
|
|
|
|