November 30, 2010 at 12:25 pm
Please help in turning the store procedure result into excell and also to call this store procdure to batch file.
The store procedure suppose is;
USp_Sqlmonitor
November 30, 2010 at 12:28 pm
SSIS can create Excel files from proc output.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
November 30, 2010 at 2:19 pm
I don't want to depend on sql agent or ssis. I want to create the procedure to execute and result output should be in excell so that I can call this procedure into batch file.
November 30, 2010 at 2:54 pm
try using xp_cmdshell to BCP the results to an XLS file. Excel might complain that it is in the wrong format but should still open the file.
exec xp_cmdshell 'bcp "exec database.dbo.usp_Sqlmonitor" queryout c:\temp\test.xls -c -T'
November 30, 2010 at 3:00 pm
If you output the format as if it were a CSV (commas and quotes), and put an xls file extension on it, Excel will open it without complaining. I've done that before.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
November 30, 2010 at 8:29 pm
Thank you all for your response. I will try it tomorrow.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply