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 |
|
DBADave
Constraint Violating Yak Guru
366 Posts |
Posted - 2008-05-05 : 02:12:44
|
| I would like to create a SQL job that runs a basic query monthly and saves the results as a .xls file and emails the results to a user. I've been unsuccessful with sp_send_dbmail in that the output file is always a single column. Any suggestions?Thanks, Dave |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-05-05 : 22:52:15
|
| Or with sqlcmd. |
 |
|
|
DBADave
Constraint Violating Yak Guru
366 Posts |
Posted - 2008-05-06 : 14:59:01
|
| I tried SQLCMD, but was unable to get the results to appear in separate columns on the spreadsheet. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-06 : 15:07:50
|
| If you want to use sqlcmd, then you'll need to concatenate all of your outputted columns together and separate them with a comma. So you are CSV'ing them manually.I'd just use bcp though. That's what we've got setup in production for a similar problem.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
DBADave
Constraint Violating Yak Guru
366 Posts |
Posted - 2008-05-06 : 15:13:45
|
| Thanks Tara |
 |
|
|
|
|
|