Masking characters in varchar

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers Meta

Q&A about the site for Drupal developers and administrators

CREATE TABLE #tab(col VARCHAR(100));

INSERT INTO #tab
VALUES ('Walmart'),('Exxon Mobil'), ('Green Mountain Coffee'),('Apple');

SELECT col, 
masked = STUFF(col, 2, LEN(col)-4, REPLICATE('*',LEN(col)-4))
FROM #tab;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results