Replace function in SQL

  • A+
Category:Languages

I have a sample text that contains '-' or ' '. So I want a sql replace statement that replaces both '-' and ' ' with ''.

My query is:

SELECT REPLACE('SQL-Tu torial','-',' ',''); 

Desired outcome:

SQLTutorial 

Error: I get error for Replace function arguments.

The replace function requires 3 argument(s).

Any help?

 


You can use this exactly :

SELECT REPLACE(REPLACE('SQL-Tu torial','-', ''), ' ', ''); 

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: