user3269770
user3269770

Reputation: 33

Replace Regular Expression in Sql

I have a Table in Sql

Table 1:

========================================

ID     Text
1      i am a boy
2      boy!what are you doing?
3      that boy is nice
4      He is a Boy and go to school

========================================

i wants to Replace word boy(case insensitively ). like Replace boy to Man then output show be

Table 2:

========================================

ID     Text
1      i am a Man
2      Man!what are you doing?
3      that Man is nice
4      He is a Boy and go to school

========================================

what Query i need to write in Sql to do this

Upvotes: 0

Views: 45

Answers (2)

soulemane moumie
soulemane moumie

Reputation: 1175

SELECT id, REPLACE( text, 'boy', 'man' )

FROM table1

Upvotes: 1

vivekpansara
vivekpansara

Reputation: 899

You can replace using Replace command something like this:

Update tablename Set Text = replace(Text, 'boy', 'Man');

Upvotes: 0

Related Questions