The Delete Procedure
by in CodeSOD on 2023-06-01Daniel recently found this pair of stored procedures. While the code within them is simple, they hint at horrors just beyond the edge of the stage, the kinds of things that might drive one mad.
CREATE PROCEDURE [dbo].[sp_SomeProc]
@ID VARCHAR(6)
AS
IF @ID = '109369'
BEGIN
DELETE FROM table1
WHERE ID = '109369'
END
IF @ID = '100976'
BEGIN
DELETE FROM table1
WHERE ID = '100976'
END
GO
CREATE PROCEDURE [dbo].[sp_SomeOtherProc]
@ID VARCHAR(6)
AS
IF @ID = '109369'
BEGIN
DELETE FROM table2
WHERE ID = '109369'
END
IF @ID = '100976'
BEGIN
DELETE FROM table2
WHERE ID = '100976'
END
GO