Deleting table entries that belong to more than one table

  • I have an SQL DB with entries that I want to delete from the Agent Table.  When I try to delete the entry I get the error:

    [Microsoft][ODBC SQL Server Driver][SQL Server] DELETE statement conflicted with COLUMN REFERENCE constraint 'FK_SecurityEventAgent'.  The conflict occurred in database 'Entercept_4_0' table 'SecurityEvent' Column 'AgentID'.

    [Microsoft][ODBC SQL Server Driver][SQL Server] the statement has been terminated.

    I know that I have to delete the data from both because, excuse my ignorance if I state this wrong, but because they are relatioal tables.  I just don't know what command to run.

    Thanks in Advance for your help.

  • Delete the rows from your 'SecurityEvent' table first and then from the 'Agent' table.







    **ASCII stupid question, get a stupid ANSI !!!**

  • From assumptions based on your table names, it may be better to drop the CONSTRAINT to remove rows from 'Agent' and archive your security events, or to create a flag on 'Agent' to mark non-active Agents.

    Depends on what the data is for really.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply