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)

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_location".  

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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aneesh RetnakaranDatabase AdministratorCommented:
two options
1. remove the FK constraint
2. else create a dummu entry for 'NONE'

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
appbuilderAuthor Commented:
If i remove the foreign key constraint, what will happen to the rest of my records in the dbase?
appbuilderAuthor Commented:
Do i really need foreign key constraints in the first place?
appbuilderAuthor Commented:
Thanks !
Aneesh RetnakaranDatabase AdministratorCommented:

FK as for implementing Referential integrity:)

Aneesh R
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.