Solved

Varchar(Max) problems

Posted on 2007-03-26
4
3,027 Views
Last Modified: 2012-06-27
Hello,

I am just embarking on a new project, and we have hit a scenario where we need to store more than 8000 characters in the field. Since we have upgradede to SQL 2005 it seems like the ideal opportunity to use VarChar(MAX).

However, i have read a couple of articles on the web saying that Classic ASP cannot handlle any string longer than 8000 characters and so therefore cannot read a string passed from the database if it exceeds this length. Is this true?

Whilst on the subject, in ASP i would setup my output parameters like so

.Parameters.Append .CreateParameter("@chvBody", adVarChar, adParamOutput, 1000)

However, with a MAX field i dont know the length of the output so, do i still declare the datatype as adVarChar, and what do i put as the length?

Thanks in advance

Al
0
Comment
Question by:higgsy
4 Comments
 
LVL 8

Accepted Solution

by:
drydenhogg earned 500 total points
ID: 18793347
You will have a dependency to SQL Native Client for this, VarChar(Max) has native client support, MDAC will not support it. So if your classic ASP can not gone up to SNAC then you do have a problem. When MDAC looks at a SQL 2005 VarChar(Max) it see's a text data type.

You will need to use the adLongVarChar types that used to be used for text, they handle the varchar(max) now within ADO. I have not seen the value you would use for the parameter length, in theory 2,147,483,647 is the max length of it (2^32 -1)

http://msdn2.microsoft.com/en-us/library/ms130978.aspx

hth
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18793542
>>what do i put as the length?

CLng(Len(your_actual_fields))

>>variables in Classic ASP are of type variant so a string variant can hold a variable-length string that can be up to approximately 2 billion characters in length. (from the VBScript / ASP documentation)

0
 
LVL 9

Expert Comment

by:fuzzboxer
ID: 18819887
You could try using the "text" data type.  It has a max length of 2^31.  That would be over 2 million.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 18820142
>>You could try using the "text" data type. <<
The text data type is a deprecated data type, the questioner is better off using varchar(MAX)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now