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 2005 Forums
 Transact-SQL (2005)
 string function

Author  Topic 

js.reddy
Yak Posting Veteran

80 Posts

Posted - 2007-10-09 : 08:26:42
I have the following table(example).

businessname
------------
books & stationary
computers & mobiles
fruits & all
male & female
each & ever



I want to replace businessname column as
businessname
------------
books & stationary
computers & mobiles
fruits & all
male & female
each & ever

Can any one help me please!!

Thanks and Regards.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-10-09 : 08:28:37
You want to replace it with what?

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

js.reddy
Yak Posting Veteran

80 Posts

Posted - 2007-10-09 : 08:36:12
I have the following table(example).

businessname
------------
books and stationary
computers and mobiles
fruits and all
male and female
each and ever



I want to change businessname column fields(and with &)

businessname
------------
books & stationary
computers & mobiles
fruits & all
male & female
each & ever

Can any one help me please!!

Thanks and Regards.



quote:
Originally posted by harsh_athalye

You want to replace it with what?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-10-09 : 08:47:14
[code]Update Table
Set businessname = Replace(businessname, 'and', '&')[/code]

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

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-09 : 08:51:11
Update Table
Set businessname = Replace(businessname, ' and ', ' & ')

Use leading and trailing spaces, or titles like "mandatory" will look ugly...



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-10-09 : 08:55:00
Nice catch Peter!

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

- Advertisement -