Showing posts with label current. Show all posts
Showing posts with label current. Show all posts

Thursday, March 29, 2012

Creditcard Validation script

Does anyone have a T-SQL script or function that validates US creditcard
numbers?
I am not talking about whether the account is current, just whether the
numeric value of the card is valid. Something similar to what one might use
for zip codes or phone numbers.
Right now I have something that looks for 15 or 16 characters in length and
then checks the first digit for the type of card (e.g., 3 = Amex).
However I was hoping that someone who has worked with this issue might give
me some insights into what conventions or standards a credit card number mus
t
comply with in order to be valid.
ThanksOn Sun, 19 Feb 2006 11:12:26 -0800, "Dave" <Dave@.discussions.microsoft.com>
wrote:
in <331D1E4C-2EB2-4ABF-ACC5-08F5D3E5FC2A@.microsoft.com>

>Does anyone have a T-SQL script or function that validates US creditcard
>numbers?
>I am not talking about whether the account is current, just whether the
>numeric value of the card is valid. Something similar to what one might use
>for zip codes or phone numbers.
>Right now I have something that looks for 15 or 16 characters in length and
>then checks the first digit for the type of card (e.g., 3 = Amex).
>However I was hoping that someone who has worked with this issue might give
>me some insights into what conventions or standards a credit card number mu
st
>comply with in order to be valid.
>Thanks
Here's a URL that I took to heart and converted to VBScript for use in my
classic ASP environment:
http://www.sitepoint.com/print/card...ation-class-php
If you want to see the VBScript also, post back and I'll put it up. I felt
that
this covered it well enough that ashamedly I didn't make any efforts to furt
her
validate the facts that the author presented.
Stefan Berglund

Tuesday, March 20, 2012

Creating table daily

How can I create a table daily, whose name was the current date in the yy/mm/dd format plus the algarism to identify the weekday (for example Wednesday = 4), for instance if the query was run on 01/15/2003 (wednesday), the tabelname would be 3_01_15_4 ?Originally posted by cassianorsilva
How can I create a table daily, whose name was the current date in the yy/mm/dd format plus the algarism to identify the weekday (for example Wednesday = 4), for instance if the query was run on 01/15/2003 (wednesday), the tabelname would be 3_01_15_4 ?

declare @.date char(9)
set @.date = substring(convert(char(4),getdate(),121),4,1)+'_'+ substring(convert(char(7),getdate(),121),6,2)+'_'+ substring(convert(char(10),getdate(),121),9,2)
+'_'+cast(DATEPART(dw, GETDATE()) as char(1))|||Thank you !

The table creation is not included on the proceedure above, right ?|||Originally posted by cassianorsilva
Thank you !

The table creation is not included on the proceedure above, right ?

No it's not, once u have the string in the @.date variable, just concatenate that with ur tablename and use that string in ur table creation

says ur final tablename is in a variable @.tablename.

exec('Create table '+@.tablename)

Sumthin around those lines