Re: SQL Server String Concatenation Limits

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Larry Menzin (LarryMenzin_at_discussions.microsoft.com)
Date: 10/25/04


Date: Mon, 25 Oct 2004 10:19:02 -0700

Adam,

This is because of the 8000 character limit on varchar strings. If our
string exceeds the limit, we have no choice but to work in chunks. Is there a
different approach that would work? We dynamically build SQL strings from a
metadata repository and these strings can exceed 20,000 characters.

Larry

"Adam Machanic" wrote:

> Larry,
>
> Why are you passing the strings in as three shorter chunks instead of a
> single large chunk? You're correct, you will need to use UpdateText to
> append the strings if you do need to work with 8000-characters at a time.
>
>
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
>
> "Larry Menzin" <LarryMenzin@discussions.microsoft.com> wrote in message
> news:519A3B7F-8A47-499D-95D4-AC0AF1B38CD9@microsoft.com...
> > We are using long SQL strings (up to 24,000 characters)
> > for some of our operations. We need to insert these long
> > strings into a text field in a table for logging purposes.
> >
> > Using @string1, @string2, and @string3, all of which are
> > up to 8000 characters, we cannot succeed in using:
> >
> > INSERT
> > into TestTable
> > Select @string1+@string2+@string3
> >
> > and get more than 8000 characters in the table field (defined as text
> type).
> >
> > What are we doing wrong? What is the workaround? Would
> > using WriteText and UpdateText be useful?
> > .
> >
> >
> > --
> > Larry Menzin
> > American Techsystems Corp.
>
>
>



Relevant Pages

  • Re: Photon vs Wave emissions from antennas?
    ... billiard ball shaped "chunks" of energy? ... I now see 'em as cubes, tubes, polygons, irregular, indescribable, ghostly, luminous, streaming strings ... ... This is quite better than my slow acceptance of the ether and "our matter/energy" only existing as an "altered and unnatural form" of this very same ether ... ...
    (rec.radio.amateur.antenna)
  • O(1) unicode string-ref/set!
    ... case where ASCII-only strings are the norm, ... Both record1 and record2 suffer from poor worst-case space- ... inefficiency compared to standard UTF-8 and UTF-16. ... several large chunks). ...
    (comp.lang.scheme)
  • Re: SQL Server String Concatenation Limits
    ... > This is because of the 8000 character limit on varchar strings. ... > string exceeds the limit, we have no choice but to work in chunks. ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: :) Contest: fast way to chop string in short fixed pieces.
    ... >>chunks of a fixed length. ... > This version seems to be competitive for strings longer than ... Is the timingof the [puts] relevant? ... OTOH, if it is not relevant, the timing test should build a list of ...
    (comp.lang.tcl)
  • Re: :) Contest: fast way to chop string in short fixed pieces.
    ... >chunks of a fixed length. ... This version seems to be competitive for strings longer than ... DOULOS - Developing Design Know-how ...
    (comp.lang.tcl)