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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select replace update function

Author  Topic 

cardgunner

326 Posts

Posted - 2007-06-14 : 08:55:46
I read some bol on this as well as searched the forum however i just want to clarify

when using the following select replace
select replace (cust.add1, 'p.o.','PO')
from cust
where cust.id='20'
I'm not permanetly replacing p.o. in the table?
So if I needed to join to tables on table having p.o. on the other table po i could use this WITHOUT permanetly changing a table's content.

In order to do this I would have to mingle in an Update clause as well?

Card Gunner

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-14 : 09:01:45
Yupps!

SELECT is only for display purpose. If you want to change column values, you will have to use UPDATE.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

PeterNeo
Constraint Violating Yak Guru

357 Posts

Posted - 2007-06-14 : 09:03:12
Replace will not modify the data in the table. If u want to join 2 tables then
u can use like this

Select t1.id, t2.id
From @t t1
Inner join @t2 t2 on t1.add1 = replace (t2.add1, 'p.o', 'PO')

Go to Top of Page

cardgunner

326 Posts

Posted - 2007-06-14 : 10:58:11
Thanks.

I'm just a little nervous and gunshy. I could feel the reprecusions if I did change it, permanetly.



Card Gunner
Go to Top of Page
   

- Advertisement -