Showing posts with label card. Show all posts
Showing posts with label card. 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

Friday, March 9, 2012

Missing SET keyword.

Using the following update command I get the following message

UPDATE Last, First, [Card Number], [Phone Number], IDKey
FROM dbo.LibUserS

error:

Missing SET keyword.
Unable to parse query text.

incorrect syntax near ','

thats correct. The update statement requires the fields to update as well as on which record you want to update. Example:

UPDATE [TableName]

SET [FieldName] = someNewValue

WHERE [fieldName] = SomeValue

typically:

UPDATE [dbo.LibUserS]

SET Last = @.p1,

SET First = @.p2,

SET [Card Number] = @.p3,

SET [Phone Number] = @.p4

WHERE IDKey = @.IDValue

the @.parameter is the parameter you supply in the query on the command object (OleDbCommand or SqlCommand, whichever database connection/driver you are using) so it can take those values and replace them with the @.parameter "placeholder" if you like.

|||Helped, perfect, Thanks!