hi
if i have table employee with employee_id as a primary key
how can i assign the primary key to the columns firstname and lastname?

table structure is something like this :

employee_id int not null, firstname varchar(20) not null, lastname varchar(20) not null
the problem is that there is a foreign key in other table that referes to the table employee , so when i try to delete the primary key i get error said i can't delete coze it refers to other table ...

other q
if i create foreign key by this way
alter table le_order
add constraint fk_salesman foreign key (Salesman_id) REFERENCES employee
how can i update this statement and add
on delete set null
and to set it to null is that correct for first problem

thx
note : sorry my english isn't good , if you please excuse me.

mike
the first problem is called referential integrity, u cant delete a row with an id and its found in another table as foreign id, u have first to delete in the second table. Its wrong to put the first name and last name as primary key. keep the primary id as it is.

about the second question, i didnt understand wht u mean, can u rephrase it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.