SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to drop the second table automaticlly
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jpham
Starting Member

USA
19 Posts

Posted - 09/28/2006 :  19:05:50  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
1837 Posts

Posted - 09/28/2006 :  19:47:25  Show Profile  Reply with Quote
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

India
22772 Posts

Posted - 09/28/2006 :  21:14:47  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Duplicate of http://sqlteam.com/forums/topic.asp?TOPIC_ID=72745

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000