0

Difference between STUFF and REPLACE IN SQL SERVER

23rd Mar 2017, 11:22 AM
Akwin Lopez
Akwin Lopez - avatar
1 Réponse
+ 2
DECLARE @String AS VARCHAR(100) SET @String = ‘Pawan’ –USE OF STUFF SELECT STUFF ( @String , 2 , 3 , ‘X’ ) as ‘STUFFSTRING’ This will replace all the characters starting from 2 to length 3 to X Output : pXn SET @String = ‘Pawan’ –USE OF REPLACE SELECT REPLACE ( @String , ‘a’ , ‘X’ ) as ‘REPLACESTRING’ This will replace all occurances of a with X Output : pXwXn
23rd Mar 2017, 11:22 AM
Akwin Lopez
Akwin Lopez - avatar