Quantcast
Channel: Answers for "where clause in delete statement with two conditions"
Viewing all articles
Browse latest Browse all 10

Answer by ozamora

$
0
0
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

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images