i have to read a contents of the record with a textfield. i have to write a stored procedure which will retrieve id, last_name, first_name and resume field which can be very large. i understand that i must use readtext statement, but i cant figure out show to combine the readtext with regular select query that returns a complete record. [select id, first_name, last_name from xxx ....]. please help..
Who is Participating?
Gustavo Perez BuenrostroConnect With a Mentor Commented:
You can not use a select statement to return all
bytes in a text column because the full amount of data
returned depends on the value of TEXTSIZE set option.

You must use SELECT and UPDATETEXT to do it.

Consider next code to write a stored procedure that returns
output parameters for id, last name and first name columns
and a Recordset with the resume information.

use pubs  -- this example works using PUBS database

 @tPtr  varbinary(16)
,@chunk varchar(10)   -- supose @@TEXTSIZE = 10
,@bytes int

select pr_info
  into #temp from pub_info
 where pub_id = '1756'

SELECT @tPtr=TEXTPTR(pr_info) FROM #temp

select @bytes = isnull(datalength(pr_info),0) from #temp
if @bytes > 10 select @bytes = 10

while @bytes > 0
    SELECT @chunk = CONVERT (varchar(10),pr_info) FROM #temp
    SELECT @chunk
    UPDATETEXT #temp.pr_info @tPtr 0 @bytes
    select @bytes = isnull(datalength(pr_info),0) from #temp
    if @bytes > 10 select @bytes = 10

PD: Please let me know if it solves your problem.

What are you using as the client. VB/C++ with ADO etc ?

ADO hides the complexity of text fields, you can just issue a normal select/stored procedure and the text field will be returned in a field of type adLongVarChar.

Make sure you have the latest Data Access Components (downloadable from microsoft)  as earlier ones didn't cope as well.
Gustavo Perez BuenrostroCommented:
Could you give more information?
A simple example would be good to undestand your request.
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

Did my suggestion answer your question?

Gustavo Perez BuenrostroCommented:
Mishab, please reject or accept simonsabin´s proposed answer. I need to know if I can help you.
Cutomers are often quite slow in responding. you will be informed when he does so just sit back and relax
mishabAuthor Commented:
I use ASP with Java Script. I have to be able to read large amount of test from a text field using stored procedure.
can you explain how you create the table so uses three regular varchar fields and then one big field for coments and lots of data like this resume example?

I will award points?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.