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't use 3 parameters in a REPLACE function. Instead you can use it twice just like below :
SELECT REPLACE(REPLACE('SQL-Tu torial', '-', ''), ' ', '');
Output :
SQLTutorial
Nest two REPLACE functions.
REPLACE(REPLACE())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With