August 11, 2005 at 5:13 am
I have been using the script from link below to export an SQL query to an excel file which works great, but i have started to make this into a Stored procedure so i can give filename, and sql statement and produce the excel file.
How do I Create the Table and worksheet without knowing how many fieldsthere will be, as this will change depending on the SQL query.
I want to bae able to send
SELECT * FROM .... ( I know your not supposed to use this but i write one off statements to extract data using query analyser, so select * would be good but named fields would be just as good)
or
SELECT name,address,phone FROM
or
SELECT name FROM
there could be 20-30 fields (or more)
without having to change the SP.
http://www.sqlservercentral.com/scripts/contributions/763.asp
THANKS
August 11, 2005 at 8:52 am
I guess if i can find a way of creating a table based on the SELECT statement passed to the SP, i can get it to work unless anyone has any better ideas.
Thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply