Connecting Tech Pros Worldwide Help | Site Map

Is it possible to delete from two tables with one SQL run?

Reney
Guest
 
Posts: n/a
#1: Nov 20 '05
I have an Employee Table with "employeeID" primary key. And this table has a
"one to many " relation with TimeLog table, which has "employeeID" and
"dayOfWeek" as Primary Key fields.
In one form, I need to delete an employee selected by the user of the
program. But since Employee table is related to the TimeLog table, it won't
let me to delete. How could I delete the selected employee from both of the
tables?

Reney


Reney
Guest
 
Posts: n/a
#2: Nov 20 '05

re: Is it possible to delete from two tables with one SQL run?


Hi Fergus,

Thanks a lot for your response. I corrected my problem following your
reccomendation. After I deleted all the TimeLog entries, there were no
problems left to delete the record in the Employee table...

Have a great day,
Reney

"Fergus Cooney" <filter-1@tesco.net> wrote in message
news:OgwPneCcDHA.748@TK2MSFTNGP10.phx.gbl...[color=blue]
> Hi Reney,
>
> You'll have to delete all the TimeLog entries first. Then the[/color]
Employee.[color=blue]
>
> It doesn't make sense in a relational database that a TimeLog entry is
> associated with a non-existant Employee. So it prevents you from deleting[/color]
the[color=blue]
> Employee until there is nothing dependant on it.
>
> Regards,
> Fergus
>
>[/color]


Closed Thread