Click here to Skip to main content
15,898,538 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how Can i create a foreign key column with user defined name???


eg.
SQL
ALTER TABLE Events.Event  ADD  CONSTRAINT FK_Employee_ID as ID_Of_Employee_Managing FOREIGN KEY(Employee_ID)
REFERENCES Events.Employee(Employee_ID)



is this correct or i have to change something in the above code??
Posted

1 solution

If you meant naming of foreign key constraint, then:
SQL
ALTER TABLE Events.Event  ADD  CONSTRAINT FK_Employee_ID as ID_Of_Employee_Managing FOREIGN KEY(Employee_ID)
REFERENCES Events.Employee(Employee_ID)
 
Share this answer
 
v2
Comments
[no name] 7-Jun-14 23:19pm    
thnx
Peter Leow 7-Jun-14 23:28pm    
You are welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900