Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1064633

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T19:23:35+00:00 2026-05-16T19:23:35+00:00

I have a table containing a large number of rows. Each row has 2

  • 0

I have a table containing a large number of rows. Each row has 2 columns which I need to use – the first is some HTML formatting and the second is the text. I need to concatenate all these rows into a single string value so that I can e-mail this massive string. Due to the large number of rows I can’t use a VARCHAR variable – I have to use text. The current solution is to use a cursor to read all the rows and then insert into a temporary table with a single column of type text and then simply append to the single row in that table.

The problem is that the string seems to get cutoff after about 33000 characters. I have absolutely no idea why this is happening.

EDIT: I have taken some of the advice from the answers given here and changed the solution to use VARCHAR(MAX). However I’m still getting cutoff, but in a very odd way. It doesn’t seem like the variable is getting an overflow, it’s simply not appending all the values.

DECLARE @Result VARCHAR(MAX)
SET @Result = ''

SELECT @Result = @Result + ltrim(isnull(format,'')) + '&nbsp;' + text + '<BR></TD></TR><TR><TD CLASS="GEN" align="left" BGCOLOR="#E9ECFD">' 
FROM SomeTable

The really odd bit is that if I take out the bit where I’m appending all that html at the end of the line, it all works fine. I’ve even inserted everything into a tmp table first and then did this concatenation select – still no luck. The tmp table contains the correct values (including the html), but the final variable doesn’t.

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Related Questions

I have a table containing integer values from 0 to some large number N,
I have a Django model with a large number of fields and 20000+ table
I have a .SQL file containing a large number of queries. They are being
I have a number rather large, complex xml documents that I need to loop
Related to a question I asked earlier here , I've found a problem which
I have been getting an intermittent issue when executing to_number function in the where
How can I make an ORDER BY clause with a small LIMIT (ie 20
What is the best way to maintain a unique ID field across multiple database
I want to compare C++ class/structure objects. In C, most of the time, one
Is it possible to read/write data from/to a file in a PL/SQL block without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.