Hoe to retrieve lenth of TEXT datatype column ?

Hello,
I got a table with a datatype column defined as text.
As you know, to retrieve the column we got to use this syntax:

/////////////////////////////////////////////////////////////////////
DECLARE @ptrval varbinary(16)
SELECT @ptrval = TEXTPTR(FORMULAIRE)
 FROM FORM_ABC
WHERE     (CODE = 35861)

READTEXT FORM_ABC.FORMULAIRE @ptrval 100 1000

///////////////////////////////////////////////////////////////////////

this will retrieve  value between the character 100 And 1000.

if want to retrieve ALL the string, what should be the syntax, or how can I got the lenth of the specific row ??


bruno_boccaraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
select @len = datalength(FORMULAIRE) from FORM_ABC where code 35861

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
adatheladCommented:
Hi,

You can use DATALENGTH(ColumnName) to get the length of the text data:
e.g. SELECT DATALENGTH(FORMULAIRE) FROM FORM_ABC WHERE CODE = 35861

So you should be able to do:
DECLARE @ptrval varbinary(16)
DECLARE @Size INTEGER
SELECT @ptrval = TEXTPTR(FORMULAIRE), @Size = DATALENGTH(FORMULAIRE)
 FROM FORM_ABC
WHERE     (CODE = 35861)

READTEXT FORM_ABC.FORMULAIRE @ptrval 100 @Size
adatheladCommented:
Apologies for duplicate
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

bruno_boccaraAuthor Commented:
The SQL query analyser has a limit value of 8092 character, do you know how can I overpass this value to got a string greater than this value ?
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Do you really need more that that in Query Analyzer?
adatheladCommented:
The approach I've taken to view all the data in a TEXT column, has been to write a noddy VB.NET app to query the data and display in a simple form
Guy Hengel [angelIII / a3]Billing EngineerCommented:
You could write a small stored procedure that shows the value of the TEXT column by splitting it into handy portions of 400 characters in form of rows...
bruno_boccaraAuthor Commented:
to angelIII:

do you have antoher way to see the result ?

I got string between 20k-50k characters
Guy Hengel [angelIII / a3]Billing EngineerCommented:
As mentionned a quick & dirty procedure to split the data into rows, if you want I post it
bruno_boccaraAuthor Commented:
if you could it will help me.
I ask another question and I will give you for the script 250 points.
the question will be : quick & dirty procedure to split the data into rows
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.