Send dbMail from SQL Server 2000 with Tabular structured data?

房东的猫 提交于 2019-12-11 11:29:22

问题


I am trying to achieve this kind of formatted data from my select statement and have it send via database mail in SQL SERVER 2000. I know how to do this in SQL 2008.

Column1 | Column 2
------------------
Value 1 | Value 2
Value 1 | Value 2
Value 1 | Value 2

回答1:


I have realized that this can not be done. To achieve this I created .bat file and stored procedures and sendmail utility.

First call this in your .bat file

osql -S %ServerName% -d %dbname% -U %username% -P %password% -Q "EXEC " -o %TempFile1% -s "|" -w 5000 >>%logfile%

and then call

C:\Tools\SendEmail\sendEmail.exe -f -t -u "[%ServerName%] Number of Records Processed: %lineCount%" -m "Data File Generated: %DataFile%" -a %DataFile% -s



来源:https://stackoverflow.com/questions/10037777/send-dbmail-from-sql-server-2000-with-tabular-structured-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!