tampsystems
asked on
SQL column ntext, nvarchar
We are designing a table and we need a column to handle 2000 to 5000 characters. What is the best datatype for this column? ntext, nvarchar(2000), nvarchar(5000). We are using SQL 2005 and SQL 2008.
nvarchar(max) will do.
I'd use nvarchar(max).
Lee
Lee
ASKER
that would allow for 4000 characters correct?
It allows for 2gb
ASKER
so if we set a maxlength of 5000 characters i the UI we will be safe, and we would not have any perfomance issues?
No, just set the column type to be nvarchar(max). You wouldn't be able to do nvarchar(5000) as this will exceed the row size limit.
Lee
Lee
ASKER
ok, but i should still limit the UI to restrict the entry of more then 5000 charaters, right?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can we fit 10,000 characters wth nvachar(max)?
yes, no problem. the "max" stands for 2GB of data, so 1 000 000 000 characters for Nvarchar
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.