Ever need to write reports out to a folder? I have found that creating output files are SA-WEET! (and easy too) The sample script uses BCP to create an HTML file.
This process works well for reports that need to be generated nightly and take too long to run in real time. Use an SMTP mail agent, and ALAS web based mail!
First open the script and change MYDATABASE to your database.
Second, add the script to your database then run the following:
--Create the HTML file
--See the contents
master..xp_cmdshell 'type c:\sysobjects.html'
--Run this to clean up (uncomment)
--master..xp_cmdshell 'erase c:\sysobjects.html'
You can use BCP to create HTML documents and/or HTML mail. Can create many reports fast! You could modify the output to push it to a web server.
Function to Split a Delimited String into a Table
This function splits a delimited string (up to 4000 characters long) into a single column table. The delimiter can be specified at the time of execution. If not specified, the delimiter defaults to a comma. The default length of each value is 100, but that can easily be changed.An example for usage:DECLARE @string NVARCHAR(4000)DECLARE @instruments […]
2007-05-25 (first published: 2007-04-10)