The Student Room Group

Btec it level 3 unit 2

Hi, im an 18 year old studying a national foundation diploma in it.

i have a problem, i have put together a database with all of the appropriate tables for revision, however, the problem i have is this. i can create tables for databases but when i try to input data in forms iam told


The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship (Error 3022)



what is the cause of this
Original post by THFC2023
Hi, im an 18 year old studying a national foundation diploma in it.

i have a problem, i have put together a database with all of the appropriate tables for revision, however, the problem i have is this. i can create tables for databases but when i try to input data in forms iam told


The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship (Error 3022)



what is the cause of this

The cause of this is that you have existing data in the database which is the same as that which you're trying to enter, and the table is setup to ensure uniqueness. (Or the data you are trying to add contains duplicate data within it.)

Is the database engine you're using sufficiently poor that it doesn't even tell you the name of the unique index involved, let alone provide the violating value? Have you quoted the full error message (even bits which looked meaningless) above?

If so, then look at the definition of the table you're populating to see which columns must be unique. The primary key will obviously be defined that way, but other columns may also have unique indices. Then look at the existing data in the database and compare it with the data you're trying to add. You will find the same data in both locations, which would violate the uniqueness constraint if the database accepted it.

Also check the data you're adding for uniqueness. If you're adding more than one row, and the rows themselves contain duplicates, you'll get this same issue.

Don't forget to include any columns contain auto-incrementing values when performing this comparison. For example, you may have created an "Id" column which is supposed to contain a value which increments on each row. Is this column set-up to auto-increment correctly? Are you inadvertently supplying a value for this column?
Reply 2
i should add, iam completing forms for a revision homework (Pearson past paper) and some of the columns containing data have duplicate values
Reply 3
i have been given an exam practice paper for unit two and have created relationships but when i try entering data it gives the above message
Original post by THFC2023
i should add, iam completing forms for a revision homework (Pearson past paper) and some of the columns containing data have duplicate values

Are any of the columns which contain duplicate values supposed to be unique, according to the table or index definition. If so, then that's your problem.

Quick Reply

Latest

Trending

Trending