My biggest mistake was 10 years ago when I emailed an employee about 46,000 alerts due to an infinite loop.
-- infinite loop example
DECLARE @t table (tkey int not null);
INSERT into @t values (1),(2),(3);
DECLARE @i int;
SELECT @i = tkey FROM @t;
WHILE @i IS NOT NULL
BEGIN
PRINT @i;
DELETE FROM @t where tkey = @i;
-- @i is not set if there are no rows in @t
SELECT @i = tkey from @t;
-- that was an infinite loop, should have used the following line instead
-- SET @i = (SELECT TOP(1) tkey from @t);
END