Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Problem with Database Design

Author  Topic 

iwaters
Starting Member

13 Posts

Posted - 2002-04-21 : 14:30:25
I need some help with the design of my database. I have a main table which is called 'Incidents' I also have a table called incidentLog which has a relationship with the Incidents table (the incidents table has the primary key). I also have a table of person involved in the incident which has the same relationship structure as before.

It all waorks fine and I can get all the information I want except that I cant insert something into the incidentlog table if it doesn't have a person linked to it (i.e. a system insert). How can I do this?

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-04-21 : 22:13:03
I don't know what you mean by a "system insert" but it sounds like you're running into a Foreign Key constraint violation. To get around this, you have to insert the Person record BEFORE you can insert a IncidentLog record that references the Person.

Go to Top of Page

khalik
Constraint Violating Yak Guru

443 Posts

Posted - 2002-04-22 : 03:57:08
if i am not wrong Foreign Key constraint allow null values
i.e if value not supplied for person column it should work

======================================
Ask to your self before u ask someone
Go to Top of Page
   

- Advertisement -