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)
 Replace !!!

Author  Topic 

haroon2k9
Constraint Violating Yak Guru

328 Posts

Posted - 2010-02-17 : 09:19:36
Hi,

pl see below

Data
<example1>
<exam>ple2
examp<le3>
ex<am>ple4

above to be Replaced like
<example1>
<exam>ple2
examp<le3>
ex<am>ple4

Needs to replace
< to <
> to >

which exists anywhere in the string,has to be replaced to corresponding format..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-17 : 09:22:51
what? its showing both as same thing.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-02-17 : 09:26:33
[code]
replace(replace(col, '<', '<'), '>', '>')
[/code]



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-17 : 09:57:08
quote:
Originally posted by haroon2k9

Hi,

pl see below

Data
<example1>
<exam>ple2
examp<le3>
ex<am>ple4

above to be Replaced like
<example1>
<exam>ple2
examp<le3>
ex<am>ple4

Needs to replace
< to <
> to >

which exists anywhere in the string,has to be replaced to corresponding format..



You leave the data as such. There is no need of updation

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

haroon2k9
Constraint Violating Yak Guru

328 Posts

Posted - 2010-02-17 : 10:05:34
iam sorry this seems to be happened like html decode. :)

pl see below
< is ampersandlt
> is ampersandgt

now please help me to replace it.

Go to Top of Page

haroon2k9
Constraint Violating Yak Guru

328 Posts

Posted - 2010-02-17 : 10:11:27
like,

here html decode be used inbuilt way.so i couldn't show you the actual data.so let me add this way below ok.in place of & ,let me put this as a ampersand ok.

replace in my string as

ampersandlt is to be replaced as <(less than symbol)

ampersandgt is to replaced as >(Greater than symbol)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-17 : 10:25:19
didnt this work?

replace(replace(col, 'ampersandlt', '<'), 'ampersandgt', '>')

again make sure you replace ampersandgt with symbol

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

haroon2k9
Constraint Violating Yak Guru

328 Posts

Posted - 2010-02-17 : 12:05:23
quote:
Originally posted by visakh16

didnt this work?

replace(replace(col, 'ampersandlt', '<'), 'ampersandgt', '>')

again make sure you replace ampersandgt with symbol

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/


Thank you vishak.worked..Thanks for every one


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-17 : 12:08:34
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -