|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 1:03 PM
Points: 213,
Visits: 834
|
|
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
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 1:55 PM
Points: 15,442,
Visits: 9,571
|
|
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
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 1:03 PM
Points: 213,
Visits: 834
|
|
| 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.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Today @ 12:24 PM
Points: 888,
Visits: 1,851
|
|
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'
Bob ----------------------------------------------------------------------------- http://www.sqlservercentral.com/articles/Best+Practices/61537/
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 1:55 PM
Points: 15,442,
Visits: 9,571
|
|
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
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 1:03 PM
Points: 213,
Visits: 834
|
|
| Thank you all for your response. I will try it tomorrow.
|
|
|
|