Delete rows in a table that has multiple FKs I need to delete all the rows in the ContentData table that have the word 'DV95' in the htmldata column.

Here is what I am using:

BEGIN TRANSACTION

DELETE Contentdata
FROM Contentlinks INNER JOIN contenttasks 
   ON contentdata.contentid = contenttasks.contentid
WHERE contentdata.htmldata LIKE '%DV95%'


Here are my questions:


Is there problem in the syntax?
It keeps showing me a number of FK contraint issues due to number of table dependencies. How do I delete these rows?
If I got you right - you need to delete referencing rows prior to deleting the referenced rows.

begin transaction
DELETE Contenttasks
FROM contentdata
 where contentdata.contentid = contenttasks.contentid 
and contentdata.htmldata LIKE '%DV95%'

Delete from contentdata where htmldata like '%dv95%'
Commit