Export (0) Print
Expand All
Expand Minimize

STUFF (SQL Server Compact Edition)

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


STUFF ( character_expression, start, length, character_expression ) 

character_expression

An expression that can be implicitly converted to nvarchar or ntext.

start

An integer value or an expression that can be implicitly converted to int, which specifies the location to begin deletion and insertion. If start is negative, a null string is returned. If start is longer than the first character_expression, a null string is returned.

length

An integer or an expression that can be implicitly converted to int, which specifies the number of characters to delete. If length is longer than the first character_expression, deletion occurs up to the last character in the last character_expression. If length is negative, a null string is returned.

nvarchar or ntext

The following example deletes the second digit of the ProductID in the Products table and replaces it with the characters '000'.

SELECT STUFF(ProductID, 2,1, '000')
FROM Products
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft