Seriously, though, we will need to know a lot more about what you are trying to do and what you have done so far before we can possibly be of any assistance.
What data source?
What report?
What software?
What versions?
What OS/Servers?
Jerry: Thank you again, here is some of the facts being used: I just execute a simple query and then I use "EXEC msdb.dbo.sp_sen d_dbmail" to email it some of my co-workers as an EXCEL file.
From which system are you executing this query from? For example... are you just using like SQL Query Management Studio? Or, do you have a web application connecting to SQL?
I am executing this SQL script as a JOB from within the SQL Management Studio and works great except that the first row in my Excel file has the line that says "Changed database context to 'xxxx'."
line absolutely necessary? If you can run your processes from on database, you can eliminate this message by not switching database context. You can start your TSQL job step script in the context of source database.
Which network account is the SQL Server Agent configured to use?
Is this account set up with the ability to email (A default account of System would not be for instance)?
The solution to my problem,was quite simple; Everytime I used SP_Send_dbmail with a file attachment, the first line on my output was "Changed database context to 'XXXXX'. I found that when using SP_SEND_DBMAIL, I just needed to use the parameter "@execute_query _database=XXXXX "; This simple entry, eliminated that annoying output line!!!
Comment