Solved

body longer than 8000 in sql sp_send_dbmail?

Posted on 2014-03-03
9
1,618 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
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

688 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