Click here to Skip to main content
15,569,547 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i added all my tables.
and after that i wanna to add foreign key but my error is on 'restrict' keyword

SQL
alter table ACCESS
   add constraint FK_ACCESS_REFERENCE_USER foreign key (USERID)
      references "USER" (USERID)      
	   on delete restrict
	   on update restrict;

------------------------------------------------
the texts error is : Msg 156, Level 15, State 1, Line 4Incorrect syntax near the keyword 'restrict'.

What I have tried:

i inserted all my tables and ....
Posted
Updated 28-Mar-16 19:27pm

1 solution

restrict is not a valid syntax

It has only these options
SQL
ON DELETE { NO ACTION | CASCADE | SET NULL | SET DEFAULT }


replace the restrict with anyone of the keyword as per your need.

more info this link[^]
 
Share this answer
 
Comments
saeed rajabi 29-Mar-16 0:30am    
regards

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