STUFF() Function in SQL Server
Table of Content:
STUFF() function inserts Replacement_expression, at the start position specified, along with removing the charactes specified using Length parameter.
Syntax:
STUFF(Original_Expression, Start, Length, Replacement_expression)
Code:
Select FirstName, LastName, STUFF(Email, 2, 3, '*****') as Email From TableEmployee
prerequisite Code
CREATE TABLE TableEmployee( FirstName varchar(50), LastName varchar(50), Email varchar(50) ) INSERT INTO TableEmployee VALUES('Rambo', 'Azmi', 'Rambo@aaa.com') INSERT INTO TableEmployee VALUES('Azam', 'Ali', 'Azam@aaa.com') INSERT INTO TableEmployee VALUES('Inza', 'Hoque', 'Rambo@aaa.com') INSERT INTO TableEmployee VALUES('Jaman', 'Sk', 'Jaman@aaa.com') INSERT INTO TableEmployee VALUES('Samser', 'Alam', 'Samser@aaa.com') SELECT * FROM TableEmployee