The first time the procedure is run it returns an error message, but it does correctly export the records.
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
The next time the procedure is run it appends records to the existing excel sheet without error message.
However as I am interested in a fresh export (no append) I always get the error message.
What is the cause of this message and can it be resolved?