Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DB Mail -- query pulls data from column of TEXT datatype but does not get all of the data

Posted on 2011-02-13
7
Medium Priority
?
812 Views
Last Modified: 2012-05-11
I have a table that has a column (named 'synopsis') that is of datatype TEXT.

When I run the code below it does generate an e-mail and it does have an attachment.  The attachment drops a lot of the data that is in the synopsis column.

Instead of "Select synopsis..." I have also tried "Select convert(varchar(max), synopsis)...
and gotten the same results.

Lastly, I created a temp table with a column of varchar(max) and put the data into that table and selected from it instead -- and got the same results.

Ideas?


      
EXEC msdb.dbo.sp_send_dbmail 
	@profile_name = 'KSP DB Mail',
    @recipients   = 'eric.myers@ky.gov',
    @importance   = 'High',
    @subject      = 'Post 1 Caselog db - Nibrs Nightly Data Errors ',
    @body         = 'We had a problem',
	@query        = 'Select synopsis from db_server.my_db.dbo.my_table',
    @attach_query_result_as_file = 1

Open in new window

0
Comment
Question by:Eric3141
[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
  • 3
  • 2
  • 2
7 Comments
 
LVL 5

Accepted Solution

by:
robertg34 earned 2000 total points
ID: 34885225
By default the dbmail file attachment is limited to 1mb in size:
http://msdn.microsoft.com/en-us/library/ms190307.aspx

You can try the query_no_truncate option to return the results in the body of the message.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 34885274
>>You can try the query_no_truncate option to return the results in the body of the message.<<
Good one.

0
 
LVL 2

Author Comment

by:Eric3141
ID: 34908520
Robert,

Home sick today so can't try this -- will tomorrow at work.  

If I use the option you specify can it work with an e-mail attachment from the query?  When I try that the results seem to be truncated at only a few hundred characters when there are a few thousand in the value in the cell.

0
Independent Software Vendors: 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!

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 34909553
>>When I try that the results seem to be truncated at only a few hundred characters when there are a few thousand in the value in the cell.<<
You really need to read the article from the link posted, otherwise you would know that it is in fact 256 characters.

0
 
LVL 5

Expert Comment

by:robertg34
ID: 34910516
I reread that and I do believe it will work with attachments as well.  
0
 
LVL 2

Author Comment

by:Eric3141
ID: 34955277
ACPerkins said:
">>When I try that the results seem to be truncated at only a few hundred characters when there are a few thousand in the value in the cell.<<
You really need to read the article from the link posted, otherwise you would know that it is in fact 256 characters.
"

I was referring to whether or not it would work with the results as an attachment.  Robert had indicated using the results in the message body and the article posted did not specify.  Given that Robert seems to have experience trying this (and since I would be away from my work PC for a while) I asked if he knew.
0
 
LVL 2

Author Comment

by:Eric3141
ID: 34955411
Robert,

It worked great!  Thank-you so much.  This helps me solve a long standing problem here at worik.

Eric
0

Featured Post

Independent Software Vendors: 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

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

598 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