STUFF function in SQL Server
The article will learn and show you how to use STUFF function to insert a string into another string.
The article will explore and show you how to use the STUFF function to insert a string into another string in SQL Server.
Describe
STUFF function in SQL Server is used to insert a string into another string, the result returned is a new string after canceling some existing characters and adding another substring at the canceled location.
Syntax
To use STUFF function in SQL Server, we use the following syntax:
STUFF(string, start, length, new_string)
Parameters :
- string: the original string you want to change.
- start: position in the string to start deleting some characters
- length: the number of characters to delete from the string.
- new_string: string of characters to insert into the string at the start position.
Note :
- See also the REPLACE function for selecting and replacing strings.
- STUFF function can be used in later versions of SQL Server: SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, and SQL Server 2005.
For example
See and explore some examples of STUFF functions in SQL Server.
SELECT STUFF('TipsMake.com', 1, 11, 'Meta');
Result: 'Meta.com'
SELECT STUFF('QuanTriMang.com', 5, 3, '1234');
Result: 'Quan1234Mang.com'
SELECT STUFF('QuanTriMang.com', 12, 4, ' la website thong tin dien tu');
Result: '
QuanTriMang la website thong tin dien tu'
Previous lesson: STR function in SQL Server
Next article: SUBSTRING function in SQL Server
Update 25 May 2019
You should read it
- +25 ideas to make use of old things to decorate the house on Tet holiday can not be ignored
- How to Get Free Stuff On iTunes
- The simple way to take advantage of the old door as a coffee table
- DAY function in SQL Server
- MIN function in SQL Server
- MAX function in SQL Server
- ABS function in SQL Server
- SUM function in SQL Server
- ROUND function in SQL Server
- RIGHT function in SQL Server
- AVG function in SQL Server
- MONTH function in SQL Server
Maybe you are interested
We may be able to see the 'second moon' in the sky with the naked eye next May Evaluate the 4 best brands of shavers today The most bizarre things people ever bring to space Will the Earth be affected if the comet once destroyed the dinosaurs hitting the Sun? 'Wow!' - Has the mysterious cosmic signal of 'alien' been decoded? True moon, snow moon and comet will appear together today