Earlier, I wrote about getting data from MS-SQL with PowerShell, which is a very useful and powerful thing. But just displaying data is very limited. I have a need at work to create extract "reports" for business owners frequently into Excel. So I have leverage this scripting technique to do the legwork for me. After many iterations, I have completed the first version of a script that will take a SQL query in a text file and create an Excel file with the results. All fully automated with time-stamping, archiving of the successful query, and the ability to export XML or CSV as well.
The script is unfortunately only listed as a page on this site because WordPress does not allow posting of non-media files. You will have to copy the full content and paste it into a text file named QuerySQL.ps1. One day, I will host this weblog on a real provider in order to have better control (I will accept donations!). If many folks prefer, I will post it on my personal webspace with my ISP and provide links on request. And maybe to CodeProject too.
Feel free to use it in anyway you wish. Please learn from it if you can, or conversely, send me a note on how to improve it. I would love to get the field-name bolding working among other things.
Remember Me
b, blockquote@cite, i, strike, strong, u
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.