I am trying to delete rows from two tables the relevant information is the same as in this thread:
If I do any joining it is by DateId from both tables.
I need to Delete Name from Roster And Date And Area from RosterTimesonly if they equal the Parameters in the stored procedure. Here is my code which only deletes from Roster and not RosterTimes:
CREATE PROCEDURE [dbo].[DeleteRoster] @Name nvarchar(50), @Area nvarchar(50), @DDate Date AS BEGIN TRY BEGIN TRANSACTION DELETE FROM Roster FROM Roster INNER JOIN RosterTimes ON Roster.DateId = RosterTimes.DateId WHERE (Roster.Name = @Name) DELETE FROM RosterTimes FROM Roster INNER JOIN RosterTimes ON Roster.DateId = RosterTimes.DateId WHERE (RosterTimes.DatetoWorship = @DDate) AND (RosterTimes.WorshipArea = @Area) COMMIT TRANSACTION END TRY BEGIN CATCH ROLLBACK TRANSACTION END CATCH RETURN 0
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://www.computerprofessions.co.nr