Re: generating values
From: Joe Celko (joe.celko_at_northface.edu)
Date: 02/16/04
- Next message: Brett Peake: "Re: break one record into many"
- Previous message: Brett Peake: "Re: break one record into many"
- In reply to: Miro: "generating values"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 16 Feb 2004 15:34:42 -0800
Can we assume that the credit card number is CHAR(16)?
Can we assume that "not real" also means "not valid"? That is, you have
no need to worry about check digits and other validations you'd have on
a real credit card number.
I assume you want to avoid proprietary code that will not port, such as
GUIDs. Burt we will have to use proprietary code that will port.
1) replace digits with other digits; REPLACE() is a common string
function.
UPDATE Foobar
SET card_nbr
= REPLACE (
...
REPLACE (card_nbr, '0', '3')
...
'9', '2');
2) generate a 16 digit random integer as cast it as a string; this can
be expensive.
3) cut it into substring and concatenate them together in a different
order.
4) overwrite the credit card number with other digits in the same row,
like telephone numbers.
--CELKO--
===========================
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Next message: Brett Peake: "Re: break one record into many"
- Previous message: Brett Peake: "Re: break one record into many"
- In reply to: Miro: "generating values"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|