views:

397

answers:

2

So, I'm using SQL Server Management Studio Express,it has been working not bad so far, ignoring some of the weirdness.

But I just happened to get a whole shwack of data deleted when I happened to delete a row in a parent table. So I thought I must have cascade deletes enabled in this relationship. But, how does one determine this?? If you double click a relationship in the DB Diagram, your only option is Delete, and the tooltip only shows you the FK relationship name.

This fellow had the same problem as me: http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/1f9c1e8f-b719-476d-828e-91ac6722096a/

So, am I missing something, or is this another situation where a software company deliberately does a half assed job? I have an MSDN ultra (or whatever the highest level is) license, so will that be better, or, is there a 3rd party tool one can use??

+4  A: 

In SQL Server Management Studio Express, don't you have the option to 'design' the table. (Right click on the table, then design) ? Then, you should have an additional toolbar with an icon which looks like 3 tables and their relationships. The tooltip of that button says 'Relationships'. When you click that button, you'll see the foreign key constraints of that table, and in the dialog box, you can specify the UPDATE & DELETE rules of the FK.

Frederik Gheysels
+1  A: 

The diagram tool isn't great.

If you use the Object Explorer to open the Tables, open the table you're interested in, open Keys, you should be able to find your foreign key, right click on it and choose Modify (or choose to script it out (to window/file/etc)).

This works in SSMS 2008, haven't tried in 2005 Express, but I'd be surprised if it wasn't there (since it's basically functionality that was built into Query Analyser long ago)

Damien_The_Unbeliever