I’m creating an album and image gallery as a feature for a directory. Basically, a business can create albums, and add images to those albums.
Here are my tables:
- BD_Album (AlbumID, OwnerID, AlbumName)
- BD_Image (ImageID, OwnerID, ImageFile, ImageTitle, ImageDescription, Active)
- BD_AlbumImage (EntryID, AlbumID, ImageID)
I want to create a stored procedure that is executed when the owner deletes an album. My goal for this procedure is to clean up the tables.
DELETE FROM BD_Album WHERE AlbumID = @AlbumID --This is the obvious
DELETE FROM BD_Image WHERE ...
DELETE FROM BD_AlbumImage WHERE AlbumID = @AlbumID
My confusion comes in where I want to also remove any images from the BD_Image table that are associated with that album. (Warning, removing this album will also delete all images from within it. Are you sure?)
The owners are able to create as many albums as they’d like. They can also assign an image to multiple albums via a listbox in the form.
Probably a bit elementary, but any help would be appreciated.
Try
OR