1

I am trying to send a csv file with 15000 records via the database mail in SQL Server 2014. The problem is that when I open my email the csv only contains 209 records. I have tried the same thing in SQL Server 2012 and it works as expected - it sends the 15000 records in the csv. I have tested this on several servers with 2014 edition on them, and I have the same issue on all of them. Does anyone have an idea if something changed in the 2014 edition? Or can give me some tips on what to look at next?

The query breaks off at different points - for example one of them breaks off at 209 records as i said above, another one at 307. the last record gets truncated. the attachment size it's about 64 kb - which is well below the 4MB limit i've configured the database Maximum File Size bytes parameter. what i am doing basically is creating a job that is meant to execute a stored procedure and send the results in a csv in an email. The stored procedure is something like:

 select col1, col2, col3 
 from table A1 
 where col1 > 1000 
 order by col1
Paul White
95.4k30 gold badges440 silver badges689 bronze badges
asked May 18, 2015 at 13:58
0

2 Answers 2

3

Found the answer- it's actually a bug on 2014 RTM, please see: https://connect.microsoft.com/SQLServer/feedback/details/850260/sql-2014-sp-send-dbmail-64kb-query-result-limit

The bug is fixed in SQL Server 2014 CU4, see KB3004195.

Mark Sinkinson
10.7k4 gold badges47 silver badges54 bronze badges
answered May 19, 2015 at 8:51
0

This could be a timeout issue. Try setting the timeout for the account for 5 minutes.

EXEC msdb.dbo.sysmail_update_account_sp 
 @Account_id = <AccountID>, 
 @Timeout= 600, --(Timeout in seconds)
 @No_credential_change = 1

You will have to restart the SQL Server service for this to activate

answered May 18, 2015 at 16:15
1
  • Thank you - the timeout is already set to 600 seconds. so it must be something else. Commented May 19, 2015 at 7:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.