Burtraskkutaren
Programmer
Hi all
Trying to find an answer to a few problems but still nothing really helpful. The basics:
A simple database for testing purposes with relationships between them. Creating the foreign key when creating tables, not allowed since the referenced table isn't created yet. ALTER TABLE, works fine but when I try to use ON UPDATE CASCADE/DELETE/SET NULL it won't work. Error message:SQL Syntax in constraint is wrong. Yet, the syntax is correct according to MS own pages on the net.
OK, but not what I want:
ALTER TABLE Strings_T ADD CONSTRAINT FK_Floats_ID FOREIGN KEY (Floats_ID) REFERENCES Floats_T ;
Gives me a SQL Syntax error:
ALTER TABLE Strings_T ADD CONSTRAINT FK_Floats_ID FOREIGN KEY (Floats_ID) REFERENCES Floats_T (id) ON UPDATE CASCADE ON DELETE CASCADE ;
Might have missed something in the code right now, typing on my laptop and not having the SQL code right now but it should be correct. Can anybody help me out with what's wrong?
One solution would be to remove the FK when I update/delete but shouldn't be necessary and how do I do that with SQL syntax in Access?
Best regards from a chilly Sweden
Trying to find an answer to a few problems but still nothing really helpful. The basics:
A simple database for testing purposes with relationships between them. Creating the foreign key when creating tables, not allowed since the referenced table isn't created yet. ALTER TABLE, works fine but when I try to use ON UPDATE CASCADE/DELETE/SET NULL it won't work. Error message:SQL Syntax in constraint is wrong. Yet, the syntax is correct according to MS own pages on the net.
OK, but not what I want:
ALTER TABLE Strings_T ADD CONSTRAINT FK_Floats_ID FOREIGN KEY (Floats_ID) REFERENCES Floats_T ;
Gives me a SQL Syntax error:
ALTER TABLE Strings_T ADD CONSTRAINT FK_Floats_ID FOREIGN KEY (Floats_ID) REFERENCES Floats_T (id) ON UPDATE CASCADE ON DELETE CASCADE ;
Might have missed something in the code right now, typing on my laptop and not having the SQL code right now but it should be correct. Can anybody help me out with what's wrong?
One solution would be to remove the FK when I update/delete but shouldn't be necessary and how do I do that with SQL syntax in Access?
Best regards from a chilly Sweden