What is Stuff?
The Stuff string function deletes a sequence of characters from a source string and then inserts a string into another string.
Syntax
Stuff (Source_string, start, length, replace string)
Parameters Arguments
- Source_String:
Source_String is characters data. It can be s constant, variable, column or either characters or binary data.
- Start:
It specifies location to start deleting and inserting string.
- Length:
It specifies the number of characters that can be deleted in source string.
- Replace:
It can replace characters of the start and length of that character.
Different ways to use stuff function:
Step 1: Create a Table.
Table Column Value Comma Separated. Firstly, create an EmpMst Table.

Step 2: Insert Data in EmpMst.
You can insert data in EmpMst Table. Insert 5 records in table.

Step 3: See Table Record.

Step 4: Using Stuff in Table Column Data.
Comma separated value EmpName.

1. Replace String
Replace String in given String. e.g “John Smith” is a string to replace string “sm Bon”.
Start Position: 2 and Length: 4,

2. Using Nested Stuff
Using Stuff Inside another stuff. Given date string: 07012016 to string: 07/01/2016.

Note: To See Code Please Find out attachment.
prabhu gengaramPosted Nov 26, 2018, 8:10 AM
Once the Stuff query is ready how to use it in select means as a column in another table
Santhakumar MunuswamyPosted Jan 9, 2016, 2:22 AM
Thanks for sharing. I have small suggestion share more content or benefits for the better article
Ajay GuptaPosted Jan 8, 2016, 6:57 AM
Thank You for sharing with us
Ajay GuptaPosted Jan 8, 2016, 6:57 AM
Very good concpt
Former memberPosted Jan 8, 2016, 2:23 AM
Thank' all of you
Pankaj Kumar ChoudharyPosted Jan 7, 2016, 1:11 PM
Nice Share............
Hari ShankerPosted Jan 7, 2016, 12:33 PM
Thanks a Ton :)
Karthikeyan KPosted Jan 7, 2016, 11:29 AM
Thank you for sharing
Former memberPosted Jan 7, 2016, 9:18 AM
Thank's
Raja TPosted Jan 7, 2016, 9:13 AM
Excellent, Nice explanation. Thanks for sharing
Humayun Kabir MamunPosted Jan 7, 2016, 8:42 AM
Nice...
Yashwant VishwakarmaPosted Jan 7, 2016, 8:08 AM
Nice article, thanks for sharing. Its good to see that article on SQL Server is coming frequently !!!