Replace pattern for individual characters

Viewed 63

I need to run a select statement that replaces individual characters in an varchar column. Each character in the column will be changed. A-Z need to change to 'A' and 0-9 need to change to '0'. I think I understand how to find them with regex, but I am not sure if the replace function can be used to do this. Examples

ABC123 > AAA000
Z15X97 > A00A00

Can this be done in tsql without using substring to change each character one at a time, or without a list (25 for letters, 8 for numbers) of statements like replace(<column>, 'B','A')?

2 Answers
Related