Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql server 2005 - on delete cascade 1

Status
Not open for further replies.

tperri

Programmer
Apr 8, 2006
728
0
0
US
hi everyone,

I have a table that has already been created. Its a user table, and i have other tables with child records that need deleted when i delete a user. I'm reading that the on delete cascade is what I need to use, but I dont know how to implement it. Can anyone help me with this?

Thanks in adavance!
T
 
I don't think it matters much that the table already exists, as I've been able to do this after the fact to applications that another developer created.

The easiest way I've found is to use the database diagram capabilities in Enterprise Manager from SQL 2000 client tools. As you create foreign key relationships by literally dragging connections between the columns in your different tables that have related data, you can go to the properties of a given relationship and enable cascading updates and deletes.


Look towards the bottom for diagrams and foreign keys.
 
Ignore the fact that I mentioned SQL 2000. I forgot you mentioned 2005 specifically, but you can do this in 2k5 as well via the SQL Management Studio.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top