Arrays in MS SQL table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am creating an application for booking events. Each event has several dates
and each date has a fixed amount of available seats.

Currently in the events table I have a field for the number of available
seats and a field for the string of dates that are later parsed into a
listbox control.

The problem with my current setup is each date is sharing the same number of
available seats so if date Event A is decemented 10 so will Event B.

I need some way to associate each date with it's own number of available
seats. What is the best way to do this? An array? If so how do I store an
array in the DB?

Thanks, Justin.
 
Relational databases don't work very well with arrays. It's usually a
better idea to create a second table with a record for each event date
and have the two tables related with a key value (an ID).

Do you have any books available on database design? You'll want to
research these topics. Starting off with a bad database design can
make building an application impossible - it's like the foundation for
a house.

If you google for "relational database design", you can find some
online material. You are specifically looking at creating a one to
many relationship.

Hope this helps you out,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top