| Author |
Message |
MartinH
Joined: 15 Apr 2005 Posts: 61
|
Posted: Wed Jan 11, 2012 1:51 pm Post subject: Multi-Property Uniqueness |
|
|
Is it possible to generate unique values for a field where the uniqueness is determined by more than one field?
For instance, I am generating sales receipts and the ticket number (integer) can't repeat when two fields coincide. The fields are ShopNumber (integer) and TillNumber (integer), so there should be no repeats for the combination ShopNumber+TillNumber+TicketNumber.
Is this possible?
Thanks,
Martin. |
|
| Back to top |
|
 |
peter.peartSite Admin
Joined: 02 Sep 2008 Posts: 362 Location: Top floor, RG towers with the cool kids
|
Posted: Thu Jan 12, 2012 2:37 pm Post subject: |
|
|
Thanks for your post. Unfortunately, It's not possible to have data generated based on relationships between columns (unless it's PK > FK).
I suppose in this instance, if the value of the integer isn't important, you could use a RegEx for each column that specified a value between certain values that was different for all columns, i.e:
ShopNumber = 1 - 2000
TillNumber = 2001 - 4000
TicketNumber = 4001 - 6000
Or something along those lines.
HTH!
Pete _________________ Peter Peart
Red Gate Software Ltd
+44 (0)870 160 0037 ext. 8569
1 866 RED GATE ext. 8569 |
|
| Back to top |
|
 |
MartinH
Joined: 15 Apr 2005 Posts: 61
|
Posted: Thu Jan 12, 2012 3:54 pm Post subject: |
|
|
Peter:
If this is not available off-the-shelf, could I do it with a custom generator?
If this is (in theory) possible, I will look into writing one.
Thanks,
Martin. |
|
| Back to top |
|
 |
peter.peartSite Admin
Joined: 02 Sep 2008 Posts: 362 Location: Top floor, RG towers with the cool kids
|
|
| Back to top |
|
 |
MartinH
Joined: 15 Apr 2005 Posts: 61
|
Posted: Thu Jan 19, 2012 7:26 pm Post subject: |
|
|
Peter:
Yes, that will work fine. I'll write my own generator to support this scenario,
Thanks for the help.
Regards,
Martin. |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group