Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
DELETE FROM tblPageKeyword
FROM tblPageKeyword
JOIN tblKeyword ON tblKeyword.pkID=tblPageKeyword.fkKeywordID
WHERE fkPageID=@PageID
AND EXISTS( SELECT * FROM tblTempKeyword WHERE fkPageID=@PageID AND tblTempKeyword.fkLanguageBranchID=tblKeyword.fkLanguageBranchID)
After this statement has been run, all entries from the tblPageKeyword table is deleted for the page being processed.
If I change the EXISTS clause to SELECT * FROM tblTempKeyword WHERE PageID=@PageID AND tblTempKeyword.fkLanguageBranchID=tblKeyword.fkLanguageBranchID
, then only the rows for current page and languagebranch is deleted from tblPageKeyword. I can't say if this has any undesired side effects though. I tested this on an MS SQL Server 9.0.1406.
Thomas Andreassen