Symptom: Sending an attachment using msdb.dbo.sp_send_dbmail results in the following error:
File attachment or query results size exceeds allowable value of 100000
Open Database Mail Configuration Wizard.
Go to the “Select Configuration Task” window; Select the last option to the bottom “View or change systems parameters” and click Next.
“Configure System Parameters” window pops up, modify the “Maximum File Size(Bytes)” Parameter to your need. 10000000 (~10MB) did the trick for us.
To make it with T-SQL you can use one of Database Mail system stored procedures which is used to change configuration settings for Database Mail - sysmail_configure_sp.
MaxFileSize
parameter is used to specify the maximum size of an attachment in bytes. So you can change this value to 10 million bytes with the following line of code:
EXECUTE msdb.dbo.sysmail_configure_sp 'MaxFileSize', '10000000';
In the Object Explorer frame of SQL Server Management Studio, expand the "Management" folder. Open the Database Mail configuration wizard.
Click Next-> Choose the radio button for "View of change system parameters" and click Next.
Now change the Maximum File Size (Bytes) property and click Next, then click Finish to save your changes.
See Database Mail Configuration Wizard at MSDN for more info.