Home > Software engineering >  Replaceing words in a string sql
Replaceing words in a string sql

Time:01-27

I would like to replace words in a string using mssql. I try this:

update VS_48538  set name = REPLACE(name, '%[N]eptun[ ][-]kód%', 'Neptunkód') where name like '%[N]eptun[ ][-]kód%'

What i'd like to change is 'cc neptun -kód dd' , (just this part: neptun -kód --> Neptunkód). Replace is not working, could you help me? Thanks!

CodePudding user response:

@George Menoutis answered it: replace(name,N'neptun -kód',N'Neptunkód') Thank you!

CodePudding user response:

Oh I've just read the full description.

Then if you're trying to use Replace you need to first define the column which you want to replace.

replace(name,N'neptun -kód',N'Neptunkód')

'%' - this wouldn't work...

  • Related