Kip Verslaafde Kip Verslaafde - 5 months ago 18
SQL Question

SQL make internal relation between 2 tables

Hi i need to make a relation between tblPersoneel and tblWoonplaats but it is not working.

This is the code i am using

ALTER TABLE tblPersoneel
ADD CONSTRAINT FK_Perwoon FOREIGN KEY

REFERENCES

tblWoonplaats

GO

Answer

Try the following:

ALTER TABLE tblPersoneel ADD
CONSTRAINT FK_Perwoon FOREIGN KEY (woonplaatsId)  
REFERENCES tblWoonplaats (id)

Of course you need to use the correct column names for the ids.