body longer than 8000 in sql sp_send_dbmail?

Progold S.p.A.
Progold S.p.A. used Ask the Experts™
on
Is there a way to send a may using sql if the body is html format long more than 8000 chars?
I have a store procedure that creates automatically the text and sends to operator.
Quite often the text is longer than 8000chars

Than you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
if you declare the variable as varchar(max), it shall work correctly.
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
Are you using classic asp?  Which version of sql server?
Progold S.p.A.IT Manager

Author

Commented:
It doesn't work with varchar(max)
I tried and the email has been sent truncated with 8153 chars
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Progold S.p.A.IT Manager

Author

Commented:
sql server 2008 R2
I'm not using asp but a sql job with a store procedure
Senior Systems and Integration Developer
Commented:
The @body parameter for sp_senddb_mail is NVARCHAR(MAX), so there shouldn't be a limitation in the mail sending part itself - which would suggest the problem lies elsewhere.

Can you post the code you are using to generate the body of your message, and send it?
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
I agree, it has to work, unless somewhere in the "middle" you use varchar/nvarchar without the MAX specification ...
Progold S.p.A.IT Manager

Author

Commented:
thank you. it's working now
Carl TawnSenior Systems and Integration Developer

Commented:
Can you expand on what your problem was in the end?

If it was related to a variable somewhere then I think a point split may have been more appropriate option for closing the question.
Progold S.p.A.IT Manager

Author

Commented:
I had a intermediate store procedure which launched sp_send_dbmail.
I deleted it and use directly sp_send_dbmail with the correct nvarchar(max)
Thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial