Question

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
Was it helpful?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top