Quick Reference
The SQL Server STUFF() function deletes a part of a string, starting at a specified position, and then inserts a new part into the string at that position.
SELECT STUFF('1SMARTchicken', 7, 7, 'duck');
Output
1SMARTduck
Syntax
STUFF(string, start, length, new_string)
Parameters
Parameter | Description |
---|---|
string | The string to be modified (required) |
start | The position in the string to start deletion (required) |
length | The number of characters to delete from the string (required) |
new_string | The new string to insert into the string at the start position (required) |
SQL Notes:
- Any work being done to modify the structure of a database or delete tables or the the database itself should only be done after making a recent backup
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.