Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tejo_pan
Starting Member
10 Posts |
Posted - 2005-09-05 : 09:53:55
|
| Hi dears..I'm creating a software here in Brazil that is similar to PayPal, but I have a problem..I don't want use the TransactionID as Numeric (1, 2, 3, ..., 3534, 3536, ...) because the user wold able to see and know the number of the transaction, and I don't want use it as UniqueIdentifier too, because is a long string (32 characters) too long to use it without making mistake when typing it.PayPal uses a little string of identification (only 17 characters) and I think that is generate through a Stored Procedure or a Function when making a transaction.I have searched for this algorithm but without results..May you help me, creating an algorithm similar that returns a little and unique string (17 alfa-numeric characters) similar to the UniqueIdentifier?Thank you very much! |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-05 : 09:59:46
|
| How about using this?Select left(newid(),17)MadhivananFailing to plan is Planning to fail |
 |
|
|
tejo_pan
Starting Member
10 Posts |
Posted - 2005-09-05 : 10:04:24
|
| Madhivanan,I think that if I use this (Select left(newid(),17)), it may repeat, no?Thank you.. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-05 : 10:17:29
|
| In your sp, check the existance of that id and insert records accordinglyMadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-09-05 : 15:53:48
|
| We sometimes have an IDENTITY column and then store, in an additional column, a VALIDATION value calcualted from a RANDOM value seeded on the IDENTITY and also the current Date/Time.The number we quote to "outsiders" is the IDENTITY plus the "VALIDATION" column - thus they cannot "guess" the number, and it is shorter than a "GUID"Kristen |
 |
|
|
|
|
|
|
|