Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xp_sendmail and formatting

Status
Not open for further replies.

tlaksh

Programmer
Feb 25, 2001
98
US
Hello

I am using the xp_sendmail procedure in order to send query results after certain processing.

Now when the mail is recd, it has underline as in any sql query after the column names. This makes the result look very confusing. I tried to user LEFT in the query but that does not help much.

Is there any way I can format the result in a tabular format or something...

Thanks for all ur help.

Lakshmi.
 
You can remove the headings by seting @no_header='TRUE' when executing xp_sendmail. However, that removes the column names which is usually not desirable.

Usually, the formatting problem occurs for two reasons.

1- The query result is wider than the page so you get line wrapping.

2- The query result is displayed in a proportional font but was meant to display with a fixed font.

I do a couple of things to alleviate these problems.

1- Set the @width parameter large enough to handle the width of the lines returned by the query. For example, @width = 256. It is also helpful to reduce the amount of data returned by the query. Rather than use * in the Select list, name only the columns that are really needed. If possible reduce the width of columns returned.

2- Send the query result as an attachment such as sales.txt. The recipients can open the text file in Notepad or similar text reader. Notepad displays in a fixed font so the results will be easier to read because columns will allign. Set @attach_results = 'true' and if you want to specify the file name set @attachments = 'filename.txt'
Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top