I have the BCP QueryOut working fine, but now my question is how to get the header row of the stored procedure in the request. I can UNION the header row in the SP, but I run into a problem… And the header rows cannot change, ie 000000 to be on top, etc..
Here is the stored proc:
SELECT 'col1','col2'
UNION ALL
SELECT * FROM TABLE ORDER BY Name
this won’t work because the ORDER BY ruins the first row being the header row. So I’m wondering if there is another way around this? The main focus is getting the header row to come up in the text file (on the Top) when using BCP QueryOut command.
it forces sorting to work
Demo on SQLFiddle