> Of course I suppose I could just do a delete and
> catch any SqlExceptions that come my way.

yes, that's the "best practice" way to do it

foreign keys have ON DELETE RESTRICT by default, so you get an error if you
try to delete a primary key and there are foreign keys with that value

that's the way you usually want it to work

you could declare ON DELETE CASCADE, and when the user is deleted,
everything she authored or edited will disappear too

or you could, if your database supports it, declare ON DELETE SET NULL,
which means that you could go ahead and delete the user, and every foreign
key that pointed to it would be set to null (which is to be interpreted
semantically as "somebody authored this, but we don't know who it is")

none of these is particularly difficult from a technical point of view, and
the method you choose will depend more on your business rules than anything
else (e.g. all content must have an author)

but the *last* thing you want to do is write a query to do a count to see if
there are any related records -- heck, that's the database's job, that's
what relational integrity constraints are for!!

;o)


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to