Solved

body longer than 8000 in sql sp_send_dbmail?

Posted on 2014-03-03
9
1,534 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.
  • 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 52

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
Technology Partners: 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!

 

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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Find unused columns in a table 12 66
Many to one in one row 2 35
SQL Add Parameter in Variable 4 21
Upgrading to SQL Server 2015 Express 2 28
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
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…

679 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