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
 SQL Server Administration (2005)
 SQL toUpdate a space with Hypen for the given word

Author  Topic 

krishnaveni.p
Starting Member

5 Posts

Posted - 2008-03-13 : 18:20:27
Hi,
I need a Query to Update a space with Hypen for the given word.
Eg : Test- Test
should be replaced as Test--Test. Space and Hypen can accour in any place . Regardless of the place , if the world has both space and hypen then that space should be replaced with hypen ..

will this search for me ?
select *
from TBL_NaturalSearch (nolock)
where keyword like '%-% %'
or keyword like '% %-%'

i need update statement to replace the same ...

It will be good if you suggest something on this ?

Thanks in Advance !!

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-03-13 : 18:48:14
quote:
Originally posted by krishnaveni.p

Hi,
I need a Query to Update a space with Hypen for the given word.
Eg : Test- Test
should be replaced as Test--Test. Space and Hypen can accour in any place . Regardless of the place , if the world has both space and hypen then that space should be replaced with hypen ..

will this search for me ?
select *
from TBL_NaturalSearch (nolock)
where keyword like '%-% %'


Please post in SQL 2005 Transact SQL
or keyword like '% %-%'

i need update statement to replace the same ...

It will be good if you suggest something on this ?

Thanks in Advance !!

Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2008-03-13 : 19:16:17
update TBL_NaturalSearch
set keyword = Replace(Replace(keyword, ' -', '--'), '- ', '--')

=======================================
Do something for somebody every day for which you do not get paid. -Albert Schweitzer, philosopher, physician, musician, Nobel laureate (1875-1965)
Go to Top of Page
   

- Advertisement -