REPLACE(): replace all occurrences of one character or substring : REPLACE « String Functions « SQL Server / T-SQL






REPLACE(): replace all occurrences of one character or substring


5>
6>
7> -- REPLACE(): replace all occurrences of one character or substring
8>
9> DECLARE @Phrase VarChar(1000)
10> SET @Phrase = 'a a a a a a a a'
11> SELECT REPLACE(@Phrase, 'a', 'B')
12>
13> GO
--------------------------------------------------------------------
B B B B B B B B

(1 rows affected)
1>
           
       








Related examples in the same category

1.REPLACE: all instances of the second string in the first are replaced by the third string
2.REPLACE spaces