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.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 ticket sales for groups and random code ?

Author  Topic 

BitShift
Yak Posting Veteran

98 Posts

Posted - 2007-05-30 : 12:16:39
I need to provide a way to handle groups that buy tickets in bulk lots, say 20 at a time. Users can later register with a "ticket code". I need to tie these two together and provide a way for groups to buy more tickets at a later time.


There should be a code that can be generated for each ticket that a group buys. This ticket is then to be given to a user to register with. A rogue user should not find it easy to guess the code. So, I want to generate a code for each group as they register, that is a random 6 or 7 digit, alphanumeric string and then something similar for a ticket. See table definitions below.

So for a ticket code, we could have something like this:
A23486D_TR34, where A23486D would be the group code

comments/suggestions/ideas welcome

At present Ive built two tables, [groups] and [group_tickets]



[group]
id int(10) unsigned
name varchar(45)
phone varchar(10)
email varchar(45)
contact_name varchar(100)
signup_date datetime
last_update datetime
group_code varchar(6)
addr1 varchar(45)
addr2 varchar(45)
city varchar(45)
state char(2)
zip varchar(10)

[group_ticket]
id int(10) unsigned
group_id int(10) unsigned
purchase_date datetime
fill_date datetime
ticket_notes text
ticket_code varchar(12)



chrisrock
Starting Member

12 Posts

Posted - 2007-06-12 : 08:48:44
Have you looked into using guids (uniqueidentifier)? It's really hard to guess those!
Go to Top of Page
   

- Advertisement -