For testing code (even if I think its only doing SELECT - e.g. an EXEC SProc that I think only does SELECT) I always surround it with a transaction
some code to test
Then I highlight either COMMIT or ROLLBACK and execute that.
Probably won't help you with the log-full issue (although it might??) as the Log will still be full of all the junk that got rolled back. Any "mess" in the DB won't be there though, which could save you RESTORE
More normally I do this:
some code to test
so that the code automatically rolls back if I just execute it, but I can then highlight down-to, but not including, the ROLLBACK and run that. I would be doing that assuming that it will work! but that still gives me the chance to highlight ROLLBACK if it gives me way more rowcount than I am expecting! and if it looks OK then I can highlight COMMIT and execute that.
Typically my scenrio is more complex than the example I have shown, so perhaps something more like:
SET SomeColumn =XXX
WHERE SomeOtherColumn = YYY
SELECT Column1, Column2
so that I get some feedback on the relevant data to see what's what ... and then decide to Commit / Rollback
By the by ... if your Log is filling up my best guess would be that you are not backing it up often enough. I always question anywhere that backs up the log LESS that every 10 minutes. The trend seems to be to move to every minute or two. You still need enough Log BACKUP Disk space ... but any strain on the Log file itself would go away.
This will tell you the average log backup interval for a database
-- Number of Log Backups per day
SELECT [Date] = DATEADD(Day, DATEDIFF(Day, 0, BS.backup_start_date), 0),
[Type] = CASE BS.type WHEN 'D' THEN 'Full'
WHEN 'I' THEN 'Differential'
WHEN 'L' THEN 'Log'
WHEN 'V' THEN 'VerifyOnly'
ELSE '[' + BS.type + ']'
[Count] = COUNT(*),
[Interval(mins)] = (24 * 60) / NullIf(COUNT(*), 0), -- 24 hours x 60 minutes in a day :)
FROM msdb.dbo.backupset AS BS
AND BS.database_name = DB_Name() -- Current database
AND BS.backup_start_date > DATEADD(Day, DATEDIFF(Day, 0, GetDate())-10, 0) -- Limit to last 10 days
AND BS.backup_start_date < DATEADD(Day, DATEDIFF(Day, 0, GetDate()), 0) -- Exclude today (partial data)
AND BS.type = 'L' -- Log backups only
GROUP BY DATEADD(Day, DATEDIFF(Day, 0, BS.backup_start_date), 0), BS.type, BS.database_name
ORDER BY BS.database_name, [Date], type