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
 General SQL Server Forums
 New to SQL Server Programming
 How to drop the second table automaticlly

Author  Topic 

jpham
Starting Member

19 Posts

Posted - 2006-09-28 : 19:05:50
Hi All,
I have two table like TABLEA and TABLEB and whenever the user drops the TABLEA I would
like the TABLEB is automaticlly drop as well. Do I need to use the triggers and what
should I use to add the logic in for whenever the user issues the command to drop the
TABLEA the TABLEB will be dropped too.
Thanks,
JP

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-09-28 : 19:47:25
On SQL Server 2000 you cannot create triggers for DDL statements like dropping a table (you can do that on SQL Server 2005).

Users really shouldn't be dropping tables, but without knowing more about your specific case I'll assume you have good reason for doing it.

Is this just for random tables or for specific situations - you should be able to create a stored procedure that drops both tables so that the user application just calls the stored procedure.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-09-28 : 21:14:47
Duplicate of http://sqlteam.com/forums/topic.asp?TOPIC_ID=72745

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -