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.
| Author |
Topic |
|
nickkrym
Starting Member
4 Posts |
Posted - 2008-08-28 : 04:50:48
|
| Hi,I have an nchar(512) field in which I want to store (you guessed it) 512 byte strings. When I try to insert data into this field (either using PHP or SQL query analyzer), I can only insert 252 characters (i.e. when selecting what I inserted, only the first 252 bytes are returned - so I cannot be 100% sure that I am not just incorrectly selecting the inserted data). The only thing I can think of is that since it is a unicode field, each character inserted takes up 2 bytes, so the 512 bytes can only store half as many characters. Is the only solution to increase the size of the nchar column to 1024 (2*512), or is my reasoning comlpetely off?Regards |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-28 : 04:54:00
|
| use some bigger type like nvarchar(max) |
 |
|
|
georgev
Posting Yak Master
122 Posts |
Posted - 2008-08-28 : 05:33:39
|
How are you selecting the data? If it's through something like QA then this program will only return the first x bytes of data to the client...Couple of tests to see if the data is inserted correctly[CODE]SELECT DataLength(RTrim(your_nchar_column))FROM your_tableSELECT SubString(your_nchar_column, 250, 250)FROM your_table[/CODE]I wouldn't immediately jump on using nvarchar max until you can prove there really is a problem George |
 |
|
|
|
|
|