Tuesday, October 29, 2013

Inserting a string inside string using SQL Server

STUFF()

The STUFF function inserts a string into another string. It deletes a specified length of characters in the first string at the start position and then inserts the second string into the first string at the start position.

Syntax:

STUFF ( character_expression , start , length , replaceWith_expression )

SELECT STUFF('JAINUL KHAN', 7, 0, ' ABDEEN');

Returns:
---------------------
JAINUL ABDEEN KHAN
---------------------

No comments:

Post a Comment