I need to write SQL code to regression test an existing stored procedure (which I can't change).
The SP returns a resultset with named columns, like this:-
In my regression test I'd like to capture those results in a table, BUT I need to preserve the fieldnames returned by the stored proc, because I need to make sure they haven't changed.
In other words, I'd like to do:-
Then I can check that the column names in #tmp are correct.
But this syntax isn't legal. So how can I do this?