Link to home
Start Free TrialLog in
Avatar of enrique_aeo
enrique_aeo

asked on

sql server 2012 - create table (references)

hi experts,

i have this table
create table Employee
(
EmpID int NOT NULL PRIMARY KEY,
EmpName varchar (25) not null
DeptID references Department (id)
JobTitle varchar (10)
)

why the primary key constraint could be removed from EmpID column of the Employee table without creating a problem in the parent/child relationship

Any example, please
ASKER CERTIFIED SOLUTION
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of enrique_aeo
enrique_aeo

ASKER

I do not understand, please give me t-sql code
Try
alter table Employee
drop primary key
go

Open in new window

Do you mean to remove the PK of current table? If yes, try the above.
I can explain this:
why the primary key constraint could be removed from EmpID column of the Employee table without creating a problem in the parent/child relationship

with transact sql code
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No, I only this code

create table Employee
 (
 EmpID int NOT NULL PRIMARY KEY,
 EmpName varchar (25) not null
 DeptID references Department (id)
 JobTitle varchar (10)
 )
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial