Solved

body longer than 8000 in sql sp_send_dbmail?

Posted on 2014-03-03
9
1,574 Views
Last Modified: 2014-03-03
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
0
Comment
Question by:Progold S.p.A.
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39899912
if you declare the variable as varchar(max), it shall work correctly.
0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39899928
Are you using classic asp?  Which version of sql server?
0
 

Author Comment

by:Progold S.p.A.
ID: 39899944
It doesn't work with varchar(max)
I tried and the email has been sent truncated with 8153 chars
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:Progold S.p.A.
ID: 39899959
sql server 2008 R2
I'm not using asp but a sql job with a store procedure
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39900034
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?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39900041
I agree, it has to work, unless somewhere in the "middle" you use varchar/nvarchar without the MAX specification ...
0
 

Author Comment

by:Progold S.p.A.
ID: 39900054
thank you. it's working now
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39900057
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.
0
 

Author Comment

by:Progold S.p.A.
ID: 39900070
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
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question