STUFF :
The STUFF() function deletes a part of a string and then inserts another part into the string, starting at a specified position.
Note: Also look at the REPLACE() function.
Syntax:
STUFF(string, start, length, new_string)
Example:
SELECT STUFF('SQL Tutorial!', 13, 1, ' is fun!');
CharIndex()
The CHARINDEX() function searches for a substring in a string, and returns the position.
If the substring is not found, this function returns 0.
Note: This function performs a case-insensitive search.
Syntax:
CHARINDEX(substring, string, start).
Example:
SELECT CHARINDEX('OM', 'Customer') AS MatchPosition
No comments:
Post a Comment