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,
SQL Server 2012 can parse your syntax, procedures and tables with the following system procedures and functions:
They are supposedly replacing "SET FMTONLY".
I have tested them and they work a lot better than "SET NOEXEC ON" and "SET PARSEONLY ON"
Examples:
Will not throw an error:
sp_describe_undeclared_parameters
@tsql = N'SELECT object_id, name, type_desc FROM sys.indexes;'
Will correctly throw an error ("SET NOEXEC" and "SET PARSEONLY" do not throw an error in this case):
sp_describe_undeclared_parameters
@tsql = N'SELECT object_id, name, type_desc FROM sys.indexes;SELECT object_id, name, type_desc FROM sys.NOTaTABLE;'