Hi @Sudip Bhatt ,
The STUFF function inserts a string into another string. It deletes a specified length of characters in the first string at the start position and then inserts the second string into the first string at the start position.
This function searches for one character expression inside a second character expression, returning the starting position of the first expression if found.It returns a number.
The syntax of stuff:
STUFF ( character_expression , start , length , replaceWith_expression )
The value returned by the statement is the value of the start variable:
charindex('~', *anonymous user*GroupKeyvalue, charindex('~', *anonymous user*GroupKeyvalue, 1)+1)+1
The value returned by the statement is the value of the length variable:
charindex('~', *anonymous user*GroupKeyvalue, charindex('~', *anonymous user*GroupKeyvalue, charindex('~', *anonymous user*GroupKeyvalue, 1)+1)+1)-1-
charindex('~', *anonymous user*GroupKeyvalue, charindex('~', *anonymous user*GroupKeyvalue, 1)+1)
Generally speaking, for the complex form of this simple function, you only need to know the most basic syntax of the function, and then find the expression corresponding to the position of the parameter, and you can understand it layer by layer. You will find that those complicated forms are actually just illusions.
If you have any question, please feel free to let me know.
If the response is helpful, please click "Accept Answer" and upvote it.
Regards
Echo
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues November--What can I do if my transaction log is full?
Hot issues November--How to convert Profiler trace into a SQL Server table