|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to capture result from READTEXT?In the continuing saga of dealing with blobs . . .
READTEXT is a fine function, but useless by itself. I need to return the results of READTEXT into a varchar column but have been unable to do so or even find a similar example. Displaying the results in Query Analyzer is all the example MS provides. I need something like the following: Select @string = READTEXT tblFLC_Catalog.longDescription @textptr @chunkindex @chunksize Any suggestions? Michael > READTEXT is a fine function, but useless by itself. I need to return the I'm not sure I understand this. What exactly are you trying to accomplish > results of READTEXT into a varchar column (e.g. forget about READTEXT for a minute, what are you going to actually DO with each of these chunks)? Please don't start new threads, there is already a thread about this you
started half an hour ago. Show quote "Snake" <Sn***@discussions.microsoft.com> wrote in message news:DE98D97E-C3CF-44DB-8C13-1747CD3194EF@microsoft.com... > In the continuing saga of dealing with blobs . . . > > READTEXT is a fine function, but useless by itself. I need to return the > results of READTEXT into a varchar column but have been unable to do so or > even find a similar example. Displaying the results in Query Analyzer is > all > the example MS provides. > > I need something like the following: > Select @string = READTEXT tblFLC_Catalog.longDescription @textptr > @chunkindex @chunksize > > Any suggestions? > > Michael Aaron,
If you really read my orignal posting you will see that while these postings are related, this one is more specific and focused on how to use the READTEXT. Since your own responses to each of my postings is different, at least on some level even you see them differently. Show quote "Aaron Bertrand [SQL Server MVP]" wrote: > Please don't start new threads, there is already a thread about this you > started half an hour ago. > > > > "Snake" <Sn***@discussions.microsoft.com> wrote in message > news:DE98D97E-C3CF-44DB-8C13-1747CD3194EF@microsoft.com... > > In the continuing saga of dealing with blobs . . . > > > > READTEXT is a fine function, but useless by itself. I need to return the > > results of READTEXT into a varchar column but have been unable to do so or > > even find a similar example. Displaying the results in Query Analyzer is > > all > > the example MS provides. > > > > I need something like the following: > > Select @string = READTEXT tblFLC_Catalog.longDescription @textptr > > @chunkindex @chunksize > > > > Any suggestions? > > > > Michael > > > Actually, my reply here was meant for the original thread, and applies
equally to both. They are still both dealing with how to get a chunk of text from readtext into a varchar variable. There is no reason to carry on multiple distinct conversations about the same thing. Show quote > Aaron, > If you really read my orignal posting you will see that while these > postings > are related, this one is more specific and focused on how to use the > READTEXT. Since your own responses to each of my postings is different, at > least on some level even you see them differently. Snake wrote:
Show quote > In the continuing saga of dealing with blobs . . . How about querying the column directly using a SELECT statement?> > READTEXT is a fine function, but useless by itself. I need to return > the results of READTEXT into a varchar column but have been unable to > do so or even find a similar example. Displaying the results in Query > Analyzer is all the example MS provides. > > I need something like the following: > Select @string = READTEXT tblFLC_Catalog.longDescription @textptr > @chunkindex @chunksize > > Any suggestions? > > Michael Declare @MyText VARCHAR(1000) Select @MyText = SUBSTRING(pr_info, 1, 100) From pubs.dbo.pub_info Where pub_id = '0736' Select @MyText David,
Thanks for your response. I believe I read in BOL that for ntext columns over 4000 characters one must use the READTEXT function. My data is longer than 4000, therefore I must use READTEXT to parse my data and return it to my program in, say, 1k chunks. Is this an incorrect approach? I am warry of the pubs examples and sample code because they always assume the most simplistic situations and from my point-of-view ignore much of the real-world. One must always read the associated text in BOL to find the gotchas! Have a very nice 3-day weekend. Show quote "David Gugick" wrote: > Snake wrote: > > In the continuing saga of dealing with blobs . . . > > > > READTEXT is a fine function, but useless by itself. I need to return > > the results of READTEXT into a varchar column but have been unable to > > do so or even find a similar example. Displaying the results in Query > > Analyzer is all the example MS provides. > > > > I need something like the following: > > Select @string = READTEXT tblFLC_Catalog.longDescription @textptr > > @chunkindex @chunksize > > > > Any suggestions? > > > > Michael > > How about querying the column directly using a SELECT statement? > > Declare @MyText VARCHAR(1000) > > Select > @MyText = SUBSTRING(pr_info, 1, 100) > From > pubs.dbo.pub_info > Where > pub_id = '0736' > > Select @MyText > > > > -- > David Gugick > Quest Software > www.imceda.com > www.quest.com > > Thanks for your response. I believe I read in BOL that for ntext columns Well, did you TRY using SUBSTRING? Did you try the code samples that have > over 4000 characters one must use the READTEXT function. My data is > longer > than 4000, therefore I must use READTEXT to parse my data and return it to > my > program in, say, 1k chunks. Is this an incorrect approach? been posted? Also, why would you want to use 1k chunks? Didn't you say you wanted to stuff it into an NVARCHAR variable or column? If so, then why not use 4k chunks? And if all you are doing is returning the data to your program, why not just say SELECT NTextColumn FROM table, the program shouldn't have display limitations like Query Analyzer (8,192 characters). A |
|||||||||||||||||||||||