Use of SQL Server stuff functions

Source: Internet
Author: User

1. function

Deletes a character of the specified length and inserts another set of characters at the specified starting point.

2. Grammar

STUFF (character_expression, start, length, Character_expression2)

3. Explanation

character_expression is the string to be processed;

    start   is the beginning of the deletion character, the string is starting from 1, if you want to Delete , then start is 2;

    length the length of the character to be deleted, such as deleting from the second character, removing three characters, or length 2;

    character_expression2 the string you want to use to replace the deleted string (a bit of a mouthful, but not difficult to understand) ;

4, example

     such as preprocessed string character_expression is ' abcdef ' and wants to remove ' CDE ', the stuff function is:

        stuff (' ABCdef ', 3, 3, ');

     If you want to replace ' CDE ' with ' xyz ', the stuff function is

Stuff (' abcdef ', 3,3, ' xyz ');


Use of SQL Server stuff functions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.