Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL 2000

Posted on 2011-09-24
9
Medium Priority
?
375 Views
Last Modified: 2012-05-12
I have a nvarchar field set to a length of 4,000.  So, of course, I cannot insert over 900 characters into it.

Any ideas?
0
Comment
Question by:classnet
[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
  • 3
  • 2
9 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 1000 total points
ID: 36592779
classnet,

Surely you can insert 900 characters into a nvarchar(4000) column.

Do you need to restate the problem?

:)

Patrick
0
 

Author Comment

by:classnet
ID: 36592787
Check it out Patrick... just spent forever adding and deleteing characters to find out why an obiously under 4,000 piece of text doesn't fit.  

The limit with varchar is 8,000 yet only really works up to 900 as well.
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 36592812
Something else is your problem, then, because both of the following SELECTs are returning 1500 as expected:

DECLARE @foo nvarchar(4000)
SET @foo = REPLICATE('x', 1500)
SELECT LEN(@foo)
CREATE TABLE zzz (foo nvarchar(4000))
INSERT INTO zzz (foo) VALUES (@foo)
SELECT LEN(foo) FROM zzz
DROP TABLE zzz

Open in new window

0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 1000 total points
ID: 36592818
seems like you are cheking the length thru the results from the query.
you need to set the maximum column output length in query analyser.
from query analyser -> ortions -> lresults -> max lenth
set that field to 8092 (which is max)


if you jsy want to get the length from the query , use
select len(columnName) from tableName
0
 

Author Comment

by:classnet
ID: 36593019
Actually what I am trying to do is to put a 975 character question into this field... adding a letter at a time, and rerunning the page, I see that it fails at character 901.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 36593071
how are you inserting ?

did you run the query tht return the length
0
 

Author Comment

by:classnet
ID: 36593149
select len(columnName) from tableName  will return the length of the data in that field.

sqlStatement = "insert into Questions Values('" & Request.Form("category") & "', " & Request.Form("questionnum") & ", '" & Request.Form("question") & "')"

Response.Write sqlStatement

objConnection.Execute SQLStatement,,129

This "insert" works find until Request.Form("question") > 900
0
 

Author Comment

by:classnet
ID: 36593169
Ok guys... how do I handle... the data is actually in there and all is well.  I just, on some questions, can't see the data from the Enterprise manager.

Who gets points?
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 36593252
I'd be amenable to a split :)
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

688 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