Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Rasta Pickles
Posting Yak Master
174 Posts |
Posted - 2013-06-08 : 10:23:32
|
Assume this scenario:I have a simple two column text file, columns are "time" and "action". So the contents are something like17:21:33 Database accessed17:21:37 Query53 executed I would like to send the contents of that text file as the email body (not as an attachment) via SQL Mail. What's the best way?I can use BULK INSERT to pull the text file contents into a table and I am familiar with setting up the whole SQL Mail thing.I am going to format the email as HTML so I don't simply want to do a SELECT * FROM mytemptable because the output doesn't look right (and in any case it all appears on one line for some reason).Any pointers?Thanks in advance. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-08 : 14:02:40
|
you can put results in table and use @query parameter of sp_send_dbmail to run query and sent results in mail. If you want to make it html then create a procedure to create html out of table data and then call the procedure as query inside------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
Rasta Pickles
Posting Yak Master
174 Posts |
Posted - 2013-06-09 : 01:45:55
|
Many thanks! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-06-09 : 11:47:47
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|