Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

UDF Luhn's formula-credit card number validation

By Joseph Gama,

This UDF will validate a credit card number using Luhn's formula.For example 49927398716 will return 1:
print dbo.luhn('49927398716')
print dbo.luhn(49927398716)
1
1


based on:
Credit cards, validation and the Luhn formula
by
Eduardo Chaves
http://www.webdevelopersjournal.com/articles/validation.html

Algorithm converted to TSQL by Joseph Gama

Total article views: 379 | Views in the last 30 days: 1
 
Tags
miscellaneous    
 
Contribute