Link to home
Start Free TrialLog in
Avatar of rwheeler23
rwheeler23Flag for United States of America

asked on

SQL Script to Find CC Numbers

My client needs to purge all CC numbers from their database. They were using a text field to hold these numbers. There was no particular postioning of these numbers. They could appear anywhere in the string. Does anyone have a script that would find a sequence of 16 consecutive numbers or a format like NNNN NNNN NNNN NNNN? Their database in MS SQL Server 2008.
Avatar of tahula2
tahula2

select REGEXP_REPLACE('joe,bloggs,1234 1234 1234 1241,england','\d{4}\s\d{4}\s\d{4}\s\d{4}','0000 0000 0000 0000') from dual

Use a regular expression like the above one?  It replaces the number pattern with zeros.  Just adapt it for an update statement.

http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/functions115.htm#SQLRF06302
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial