Thank you for posting at Dotnetfunda [Administrator]
DECLARE @DeptID INT = 120IF NOT EXISTS (SELECT 1 FROM Employees where Department_ID = @DeptID) DELETE FROM Departments WHERE Department_ID = @DeptID
Mark This Response as Answer -- Chandu http://www.dotnetfunda.com/images/dnfmvp.gif
Declare @cnt Int = 0;Select @cnt = count(*) from Employee where dept_id = your id;if(@cnt > 0)begin delete from Employee where dept_id = your id;end
Login to post response