T-SQL Regex for social security number (SQL Server 2008 R2)
问题 I need to find invalid social security numbers in a varchar field in a SQL Server 2008 database table. (Valid SSNs are being defined by being in the format ###-##-#### - doesn't matter what the numbers are, as long as they are in that "3-digit dash 2-digit dash 4-digit" pattern. I do have a working regex: SELECT * FROM mytable WHERE ssn NOT LIKE '[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]' That does find the invalid SSNs in the column, but I know (okay - I'm pretty sure) that there is a