appbuilder
asked on
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tbl_ticket_tbl_location".
Greeting everyone.
I cant seem to find my way through this issue.
I have 2 tables in my dbase that are related:
tbl_ticket (fk)
tbl_location(pk)
These tables are related by locationID
Some companies my dbase have multiple locations others dont! So when i run an INSERT query the companies with multiple locations work fine. But, when i try to run the INSERT query from a company with no locations i get the following error message:
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tbl_ticket_tbl_locatio n".
What would you suggest i do in this instance...?
I presume im trying to insert and ticket and not associating a location to the newly created ticket but for the company with no location NONE exist. What should i do to work around this?
I cant seem to find my way through this issue.
I have 2 tables in my dbase that are related:
tbl_ticket (fk)
tbl_location(pk)
These tables are related by locationID
Some companies my dbase have multiple locations others dont! So when i run an INSERT query the companies with multiple locations work fine. But, when i try to run the INSERT query from a company with no locations i get the following error message:
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tbl_ticket_tbl_locatio
What would you suggest i do in this instance...?
I presume im trying to insert and ticket and not associating a location to the newly created ticket but for the company with no location NONE exist. What should i do to work around this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Do i really need foreign key constraints in the first place?
ASKER
Thanks !
appbuilder,
FK as for implementing Referential integrity:)
Aneesh R
FK as for implementing Referential integrity:)
Aneesh R
ASKER