My approach is to always try minimizing locks
-- Dump the records to be delete into a temp
SELECT A.entryid INTO #temp_delete
From EntryAttribute A INNER JOIN attributestring Y
ON A.attributeid = = Y.attributeid AND A.entryid = Y.entryid
WHERE (y.attributeid = '513367ff-de82-4f84-b982-8c4b854a08e1')
AND (z.attributeid = 'c74ce292-06db-420e-83a6-a32d84fefa28');
-- Add a primary key to the temp
ALTER TABLE #temp_delete ADD PRIMARY KEY (entryid);
-- Delete
BEGIN TRAN;
DELETE a
FROM #temp_delete t
INNER JOIN EntryAttribute a ON (t.entryid = a.entryid);
COMMIT;
Good Luck
Trending Articles
More Pages to Explore .....