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, 3:10 AM EST
Once the Stuff query is ready how to use it in select means as a column in another table
Santhakumar MunuswamyPosted Jan 8, 2016, 9:22 PM EST
Thanks for sharing. I have small suggestion share more content or benefits for the better article
Ajay GuptaPosted Jan 8, 2016, 1:57 AM EST
Thank You for sharing with us
Ajay GuptaPosted Jan 8, 2016, 1:57 AM EST
Very good concpt
Former memberPosted Jan 7, 2016, 9:23 PM EST
Thank' all of you
Pankaj Kumar ChoudharyTOP 100Posted Jan 7, 2016, 8:11 AM EST
Nice Share............
Hari ShankerPosted Jan 7, 2016, 7:33 AM EST
Thanks a Ton :)
Karthikeyan KPosted Jan 7, 2016, 6:29 AM EST
Thank you for sharing
Former memberPosted Jan 7, 2016, 4:18 AM EST
Thank's
Raja TPosted Jan 7, 2016, 4:13 AM EST
Excellent, Nice explanation. Thanks for sharing
Humayun Kabir MamunPosted Jan 7, 2016, 3:42 AM EST
Nice...
Yashwant VishwakarmaPosted Jan 7, 2016, 3:08 AM EST
Nice article, thanks for sharing. Its good to see that article on SQL Server is coming frequently !!!