?
Solved

Varchar(Max) problems

Posted on 2007-03-26
4
Medium Priority
?
3,086 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Accepted Solution

by:
drydenhogg earned 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

771 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