-5

I have a string that is like this word1 - null - word3, is it possible to write an sql query to remove the word null from the string of text?

Thanks

AndroidAL
  • 1,111
  • 4
  • 15
  • 35

2 Answers2

0

you can use REPLACE function:

DECLARE @Test AS VARCHAR(32)
SELECT @Test = 'word1 - null - word3'

SELECT REPLACE(@Test, 'null - ', '')
tezzo
  • 10,858
  • 1
  • 25
  • 48
0

Use REPLACE.

Query

declare @str as varchar(50);
set @str = 'word1 - null - word3';

select replace(@str,'null','');
Ullas
  • 11,450
  • 4
  • 33
  • 50