i have below sample data, i try to extract valid credit card data. But i was not able to do so ,since data is not in good format. Can any one help? below sample data have a transaction code which is also 16 numbers or more which should be considered as credit card number[code="other"]DECLARE @test TABLE (memo varchar(400) );INSERT INTO @testSELECT 'abc this account used visa :1234567890123456' UNION ALL SELECT 'this account visa 1234567890123456 request for receipt' UNION ALL SELECT 'this account visa 123456789012345612/13 exp' UNION ALL SELECT 'invoice card used 4123 4567 8901 2345 some text' UNION ALLSELECT 'paid using 4123 4567 8901 2345 thank you' UNION ALLSELECT 'Transaction code 123456454636667445 copy invoice'UNION ALLSELECT 'mastercard cc#5987-6543-2109-8765. this order will be processed' UNION ALL SELECT 'mastercard 5987-6543-2109-8765, thank you' union allSELECT ' period 1999-10-18 - -2000-10-17 '; ;SELECT * FROM @test WHERE --master or visa 16 patindex( '%[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%', memo) <>0 or patindex( '%[0-9][0-9][0-9][0-9] [0-9][0-9][0-9][0-9] [0-9][0-9][0-9][0-9] [0-9][0-9][0-9][0-9]%', memo) <>0 or patindex( '%[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]%', memo) <>0 --visa 13 or patindex( '%[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%', memo) <>0 -- amex 15 or patindex( '%[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%', memo) <>0 or patindex( '%[0-9][0-9][0-9][0-9] [0-9][0-9][0-9][0-9][0-9][0-9] [0-9][0-9] [0-9][0-9][0-9]%', memo) <>0 or patindex( '%[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9]%', memo) <>0[/code]
↧