t-sqlsql-server-2000sp-send-dbmaildbmail

Send dbMail from SQL Server 2000 with Tabular structured data?


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

Solution

  • 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