Sunday, February 26, 2012

don't allow duplicates problem

I have MSDE with the server tools from sql server 2000 enterprise edition. I
am having a problem with one of my tables. The table is set up with two
fields Class and Student. I want there to be only one student of the same
name in each class. If i use the primary key it will just allow only one
student of the same name in the entire table and wouldn't look at the class
that the student is taking. Is there an easy way around this?
I found a solution, I created a dual primary key. I highlighted both items
and then turned on the primary key and it does exactly what I wanted it to
except the maximum size is 900bytes for a primary key so I had to adjust the
length of the fields a bit.
"Benjamin" wrote:

> I have MSDE with the server tools from sql server 2000 enterprise edition. I
> am having a problem with one of my tables. The table is set up with two
> fields Class and Student. I want there to be only one student of the same
> name in each class. If i use the primary key it will just allow only one
> student of the same name in the entire table and wouldn't look at the class
> that the student is taking. Is there an easy way around this?

No comments:

Post a Comment