问题
I'm using SQL Server 2000 Enterprise Manager. I'm having trouble with storing some data in a column. The column has a data type of nvarchar, with a length of 4000, which I've now learned is the max length you can have.
I need to store data in the column that is longer than 4000 characters...is there a way to increase the size? Or is there another way to store it?
回答1:
in SQL Server 2000, the only 2 ways to increase it would be:
Use the data type VARCHAR instead of NVARCHAR (VARCHAR's limit is 8000, where NVARCHAR's is 4000) NVARCHAR is the unicode version of VARCHAR.
Use the TEXT or NTEXT datatypes. TEXT stores the value outside of your table, and can store up to 2^31 - 1 characters. NTEXT can store up to 2^30 - 1 characters.
回答2:
First, follow @Gabriel's advice if you can live with 8000 non-Unicode characters.
In places where older versions of our app needed to store larger text strings, we allocated multiple fields (textvar
, textvar2
, ...) and had standard application components to split & concatenate them where they were used. Otherwise, you can use a blob & convert as needed. Ugly but functional.
来源:https://stackoverflow.com/questions/3916451/sql-server-2000-enterprise-manager-store-nvarchar-data-greater-than-4000-chara