Sunday, 11 January 2015

STUFF function in SQL Server

The SQL Server (Transact-SQL) STUFF function deletes a sequence of characters from a source string and then inserts another sequence of characters into the source string, starting at a specified position.

Syntax:

The syntax for the STUFF function in SQL Server (Transact-SQL) is:

STUFF( source_string, start, length, add_string )

Example:

SELECT STUFF('C#Infrasolution', 8, 2, '1234');
Result: 'C#Infra1234tion'

No comments: