I\'m trying to make my integration tests more idempotent. One idea was to execute rollback after every test, the other idea was to some how programatically parse the text,
+1 to Eric's answer. But I've found SET FMTONLY ON
to also be useful as SET NOEXEC ON
doesn't appear to throw up all errors.
e.g.
SELECT * FROM ATableThatDoesNotExist
Running that with SET NOEXEC ON
says it was successful, despite the table not existing in the database. Running it with SET FMTONLY ON
instead, will throw the "Invalid object name" error.
SET FMTONLY ON also returns metadata about the resultset that would be returned, which can come in very handy