Skip to content

Instantly share code, notes, and snippets.

@hsinjungwu
Last active August 29, 2015 14:21
Show Gist options
  • Save hsinjungwu/bdf530fbead20f01e945 to your computer and use it in GitHub Desktop.
Save hsinjungwu/bdf530fbead20f01e945 to your computer and use it in GitHub Desktop.
add mask to data
DECLARE @name NVARCHAR(20) = N'王小明'
DECLARE @mask_name NVARCHAR(20)
SELECT @mask_name = STUFF(@name, 2, LEN(@name)-1, REPLICATE ('*' , LEN(@name)-1))
PRINT @mask_name
-- @mask_name = 王**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment