Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Find CC# From String
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

62 Posts

Posted - 03/26/2013 :  11:26:52  Show Profile  Reply with Quote
Hi Guys,

I have a column that may have Credit Card number(s) in the string. What I need to do is find out rows that has credit card number(s) in this column. But this column will also have couple of dates in it.

Any better suggestion please... This column can have multiple CC#s!!! Anyone has any function to find the CC#?


Edited by - SQLNOVICE999 on 03/27/2013 16:14:44

Most Valuable Yak

15732 Posts

Posted - 03/26/2013 :  11:52:08  Show Profile  Visit robvolk's Homepage  Reply with Quote
1. There's no easy way to parse credit card numbers using SQL, especially multiples, especially if they have multiple formats.
2. I hope you don't have to comply with PCI or similar regulations, since storing unencrypted card numbers is a violation.
2a. And even if you don't have to comply, your company is open to all kinds of lawsuits should there be a security breach.

As far as finding the credit card numbers, the only reasonable solution I can think of is to use regular expressions. You can use a SQLCLR function to perform these kinds of matches:

But first and foremost, you need to clean those out of your database and change how that data is entered into your system (or not at all). Google "largest credit card breaches" for more info on the potential consequences.
Go to Top of Page

Yak Posting Veteran

62 Posts

Posted - 03/26/2013 :  12:10:57  Show Profile  Reply with Quote
Thanks Rob for the response. Yes we have made changes to the application; however, I need to find the records in database (in that particular column) where there is at least one CC# in the string. We will then plan to take correct measures to obfusicate this.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.52 seconds. Powered By: Snitz Forums 2000