Click to See Complete Forum and Search --> : Increase ntext size??
WolfShade
01-07-2007, 01:09 PM
Is there a way to increase the size of an ntext column? I'm eventually going to be creating a CMS using an editor plugin for formatting, and want to make sure that all the data will fit, even if the admin is entering a 500 page novel as the data (not that I think they'd ever TRY it, but just in case one of them is heavily medicated, or something.)
The reason I made it ntext is because the client eventually wants this to be a multi-lingual site, and I understand ntext (or nvarchar) is necessary for Japanese and other such characters.
Thanks,
^_^
PS. I just read the first sticky. I'm using MS-SQL 2003 and the developing language is ColdFusion.
russell
01-07-2007, 03:02 PM
ntext is fixed size. from BOL
Variable-length Unicode data with a maximum length of 2^30 - 1 (1,073,741,823) characters. Storage size, in bytes, is two times the number of characters entered.
nvarchar can be altered as you wish up to a length of 4000.
suppose nvarchar(32)... all u need to do is issue an alter table statement:
ALTER Table myTable
ALTER Column myColumn nvarchar(4000)
this will not affect existing data in the table, but will allow longer strings to be entered.
Check BOL for data types.
:)
WolfShade
01-07-2007, 03:10 PM
nvarchar(4000) may not be enough, is my problem.
The client, so far, has kept their articles fairly small; but I want to be prepared in case they get a prolific writer who creates articles the size of novels.
4000 may seem a lot for an article (and it IS), but I have to consider the HTML code that will be generated by the editor plugin, as well. With all the <font>, <p>, and other tags that they commonly overuse, that article may be limited to 2000 or 2500 characters of actual content.
Is there another datatype that would allow for larger input, and keep the ability for double-bit characters?
^_^
PS. I tried manually entering HTML code for a form into a ntext datatype, via QA, and the code was cut in half; so it didn't work. All (') were escaped prior to the INSERT.
russell
01-07-2007, 04:07 PM
why do u think it was cut in half? was your text longer than 256 characters and only 256 displayed in QA?
in QA, go to tools, options. click results tab. change default of 256 to whatever u want. this doenst affect query results, just what query analyzer will display.
also, how are u inserting unicode data?
like this?
insert myTable(fieldName) values (N'hello world')
if still a problem, please show your insert query...
WolfShade
01-07-2007, 05:20 PM
insert myTable(fieldName) values (N'hello world')
Honestly, I don't know why it was cut in half. All apostrophe was escaped (ie, ''), the only thing that I can think of is that I didn't use (N'') for the value insert.
For each line of code, I ended it with '+ and prepended the next line with '
^_^
russell
01-07-2007, 06:16 PM
lets see the code...