Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 nvarchar only writing 900 characters :|

Author  Topic 

Sekter
Starting Member

5 Posts

Posted - 2008-06-30 : 05:43:31
Hi, I am testing this page writing a number of variables into a table in sql, the table has a number of fields and one of these fields ive called val1. Val1 is an "nvarchar" which has a length of 4000. Now for some bizzare reason i create a variable called val1 in the asp page and give it a random 1000 characters but when i input this into the field val1 nothing shows up :| (Every other variable gets written becoz they are small words but not val1). When i reduce the number of characters in val1 to 900 only then it will write. Am i misunderstanding something about nvarchar being 4000 in length why am i so limited in the number of characters i can write into the field?
I am viewing what gets written into the table in sql enterprise manager but im sure this doesnt make a difference. Thx alot help appreciated.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-30 : 05:46:46
are you sure you dont have some special characters in field which is causing this?what does LEN(column) return?
Go to Top of Page

Sekter
Starting Member

5 Posts

Posted - 2008-06-30 : 05:49:36
This is exactly what val1 string contains:
val1= "7=4.37:U,2064=-3.21:U,2586=-4.92:U,3056=5:U,3637=5:U,4101=-4.36:A,4519=-3.56:A,5042=-2.71:A,5538=-2.05:A,6008=-1.67:A,6557=-1.26:A,7027=-0.98:A,7549=-0.74:A,8108=-0.58:A,8516=-0.5:A,9012=-0.37:A,9535=-0.28:A,10005=-0.21:A,10501=-0.15:A,11024=-0.1:A,11520=-0.07:A,12079=-0.05:A,12539=-0.02:A,13009=0:A,13558=0:A,14028=0:A,14576=0:A,15047=0:A,15569=0:A,16013=0:A,16536=0:A,17006=0:A,17554=0:A,18024=0:A,18521=0:A,19043=0:A,19513=0:A,20010=0:A,20532=0:A,21029=0:A,21551=0:A,22021=0:A,22570=0:A,23040=0:A,23510=0:A,24007=0:A,24581=0:A,25025=0:A,25526=0:A,26018=0:A,26514=0:A,27089=0:A,27507=0:A,28003=0:A,28552=0:A,29022=0:A,29571=0:Affffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdffgdfgdfgdbbfsdfsdfgdfxcbxcvbedvbbnxcfbvdfgbsdfgasdfasdfbbmmmtttttest"
None of these characters are special characters becoz this gets written into the database but adding another character to the end of this doesnt get written anymore
Go to Top of Page

Sekter
Starting Member

5 Posts

Posted - 2008-06-30 : 06:21:20
Ok i have just noticed something:
When i input the data into the database 900+ characters, go to SQL server enterprise mananger and look at the val1 field it is blank, however when i write out the field content in the asp page all the data i entered shows up correctly WTH :|. So i am assuming it is something to do with SQL enterprise manager only showing 900 characters does any one have an idea why it is doing this and is there anyway to prevent it from limiting to 900 characters, this is seriously annoying becoz i cant know by looking at the field if it contains data or not.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-30 : 06:39:27
How does this behave in Query Anlyser?
Go to Top of Page

Sekter
Starting Member

5 Posts

Posted - 2008-06-30 : 06:47:48
Thats the funny part, Query Anlyser shows some of the data but not all and doesnt tell me that the display of data has been truncated. So Enterprise manager shows nothing (Making me think its writing nothing) and Analyser writes some of the data (Making me think only few values are getting written).
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-06-30 : 06:58:26
In Query Analyzer, you can increase this limit by going to Tools, Options, Results and setting maximum characters per column to higher value.

I don't use EM for viewing query results nor would I recommend.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Sekter
Starting Member

5 Posts

Posted - 2008-06-30 : 07:04:50
Cool thanks, advice taken about viewing in EM from now on, i was only using EM because i needed to delete the row preferably by pressing delete button after i got the data but i can see why its bad now. I will just assume there is no option in EM to view more than 900 characters for now anyways. Thanks for everyone who replied very much appreciated :).
Go to Top of Page
   

- Advertisement -