SQL Alter: add multiple FKs?

Posted by acidzombie24 on Stack Overflow See other posts from Stack Overflow or by acidzombie24
Published on 2010-05-19T12:59:45Z Indexed on 2010/05/19 13:10 UTC
Read the original article Hit count: 119

Filed under:

From here

ALTER TABLE ORDERS
ADD FOREIGN KEY (customer_sid) REFERENCES CUSTOMER(SID); 

How do i add several keys with SQL Server? is it something like the below? (I cant test ATM and unfortunately i have no way to test queries unless i run it through code)

ALTER TABLE ORDERS
ADD FOREIGN KEY (customer_sid) REFERENCES CUSTOMER(SID), 
ADD FOREIGN KEY (customer_sid2) REFERENCES CUSTOMER(SID2);

or is it like

ALTER TABLE ORDERS
ADD FOREIGN KEY (customer_sid, customer_sid2) REFERENCES CUSTOMER(SID, SID2)

© Stack Overflow or respective owner

Related posts about sql-server