Showing posts with label flipping. Show all posts
Showing posts with label flipping. Show all posts

Monday, March 26, 2012

MOD 10 (Credit Card Validation)

Does anyone have any strings or links I can use to help with creating a mod-10 stored proc?

I am really stuck on step 1, which is flipping the numbers (ex 1234 -> 4321)..

Any information pretaining to MOD-10 and MSSQL would be MUCH appriciated..Does this help you to flip the number?

declare @.in bigint
declare @.out bigint

set @.in = 123456789012345678
set @.out = 0

while @.in > 0
begin
print @.in %10
set @.out = @.out*10 + (@.in % 10)
Set @.in = @.in /10

end

select @.out|||It looks like it should work.. I'm going to try it in the morning!

Thanks!sql