Monday, 15 October 2012

SQL Server - Stuff()


Define:
             Stuff is a TSQL function which is use to delete specified length of Character with in a string and replace with another set of characters.
Syntax:
STUFF(Character_Expression, Start, Length, replaceWith_expresstion)
Character_Expression:
              It is an expression of character data, which can be constant, variable or table column.
Start :
             This indicates the starting position of the character in character_expression.
Length:
              It is the length of characters which need to be replaced.
replaceWith_expresstion:
             It is the string that will be replaced from the start position to the length position.

Return Type:
             Return type will be same as of Character_Expression.
Example:
     SELECT STUFF('Have a good day',8,4,'nice');
Result:
             Have a nice day

No comments:

Post a Comment

ML.NET: Machine Learning for .NET Developers

Machine Learning in .Net ML.NET is a free software machine learning library for the C# and F# programming languages. It also supports Pyth...