SQL STUFF Function

STUFF is used to insert a string into another string.

It removes characters from the original string at a starting position and length.

It then inserts the second string as replacement for the removed first string.



This example replace 'American' with 'Orient'.

SELECT STUFF('American Express', 1, 8, 'Orient') AS 'Historical Train'
Result:  1 record
Historical Train
Orient Express


Syntax of the STUFF function.

STUFF(string, start, length, insert)

string -- a string, variable, or column name.

start -- an integer specifying start location of the deletion and insertion.

length -- an integer specifying how many characters to delete from string.

insert -- a string, variable, or column name to be inserted into string.

You may also like


vsn 3.1