Reputation: 627
I have a column in my table called "service". This has value like below.
0.0.0.1 /service/telco/fixedline/**intnet** 274511977 0
I need to replace this as below
0.0.0.1 /service/telco/fixedline/**_intnet** 274511977 0
If you notice this you could see that wherever the substring "intnet" is coming , all the occurances of it should be replaced with "_intnet".
Upvotes: 0
Views: 52
Reputation: 84
select replace ('0.0.0.1 /service/telco/fixedline/intnet 274511977 0','intnet','_intnet')
Upvotes: 2
Reputation: 50173
I would do :
select stuff(col, charindex('intnet', col), 0, '_')
You can also use replace()
:
select replace(col, 'intnet', '_intnet')
Upvotes: 2