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 |
wsilage
Yak Posting Veteran
82 Posts |
Posted - 2014-01-02 : 13:10:22
|
Is there a way to export query results to an excel fie and add that file as an attachment in the email? All this has to be done using SQL query and it needs to be automated. My coworker tried using Openrowset and BCP, but it is not working.Any suggestions would be great! |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
wsilage
Yak Posting Veteran
82 Posts |
Posted - 2014-01-02 : 13:45:26
|
Thanks I tried that this morning and I am getting this error.outputUser name not provided, either use -U to provide the user name or use -T for Trusted Connectionusage: bcp {dbtable | query} {in | out | queryout | format} datafile [-m maxerrors] [-f formatfile] [-e errfile] [-F firstrow] [-L lastrow] [-b batchsize] [-n native type] [-c character type] [-w wide character type] [-N keep non-text native] [-V file format version] [-q quoted identifier] [-C code page specifier] [-t field terminator] [-r row terminator] [-i inputfile] [-o outfile] [-a packetsize] [-S server name] [-U username] [-P password] [-T trusted connection] [-v version] [-R regional enable] [-k keep null values] [-E keep identity values] [-h "load hints"] [-x generate xml format file] [-d database name] [-K application intent]NULL |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|