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 |
|
marat
Yak Posting Veteran
85 Posts |
Posted - 2005-02-21 : 18:34:44
|
| Hi I am trying to send query results in excel csv format.Could anybody tell me whar I am doing wrong.below is my script.DECLARE @cmd varchar(4000), @msg varchar(4000)SET @cmd = 'SELECT TOP 10 * from Dev_Ods..DPID_eastnorth'exec master..xp_sendmail @recipients = 'marat', @subject = 'Test', @query = @cmd, @attachments = 'Results.csv', @attach_results = True, @separator = ',', @width = 120 Thanksmarat |
|
|
marat
Yak Posting Veteran
85 Posts |
Posted - 2005-02-21 : 19:08:27
|
| I made one change to the script and it worked:DECLARE @cmd varchar(4000), @msg varchar(4000)SET @cmd = 'SELECT TOP 10 * from Dev_Ods..DPID_eastnorth'exec master..xp_sendmail @recipients = 'marat', @subject = 'Test', @query = @cmd, @attachments = 'Results.csv', @ansi_attachment = TRUE, @attach_results = TRUE, @separator = ',', @width = 120 It is strange that I couldn't find parameter @ansi_attachment = TRUE in the SQL Server Books Online:Syntaxxp_sendmail {[@recipients =] 'recipients [;...n]'} [,[@message =] 'message'] [,[@query =] 'query'] [,[@attachments =] 'attachments [;...n]'] [,[@copy_recipients =] 'copy_recipients [;...n]' [,[@blind_copy_recipients =] 'blind_copy_recipients [;...n]' [,[@subject =] 'subject'] [,[@type =] 'type'] [,[@attach_results =] 'attach_value'] [,[@no_output =] 'output_value'] [,[@no_header =] 'header_value'] [,[@width =] width] [,[@separator =] 'separator'] [,[@echo_error =] 'echo_value'] [,[@set_user =] 'user'] [,[@dbuse =] 'database']But I still have a small problem in the output:DPID EASTING NORTHING -------- ------------ ------------120000000 0 0120000007 0 0I want to get rid off the ------- linesAny ideas??Thanks |
 |
|
|
shivaji_shitole
Starting Member
1 Post |
Posted - 2010-09-20 : 06:00:30
|
| Hi,you got solution of this problem as i am also facing same.please reply |
 |
|
|
|
|
|
|
|