Dofactory.com
Dofactory.com
Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

SQL STUFF Function

STUFF is used to insert a string into another string.

It removes characters from the original string at a starting position and length.

It then inserts the second string as replacement for the removed first string.

Example

#

This example replace 'American' with 'Orient'.

SELECT STUFF('American Express', 1, 8, 'Orient') AS 'Famous Train'
Result:  1 record
Famous Train
Orient Express

Syntax

Syntax of the STUFF function.

STUFF(string, start, length, insert)

string -- a string, variable, or column name.

start -- an integer specifying start location of the deletion and insertion.

length -- an integer specifying how many characters to delete from string.

insert -- a string, variable, or column name to be inserted into string.


You may also like



Last updated on Dec 21, 2023

Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.