Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a new text column in a SQL Server Table: which type should I choose?

I have a text field that can be 30 characters in length, however it can achieve around 2.000 characters.

For "future safety", it would be nice if this new column could support until 3.000 characters. I think the average size of this field is 250 characters.

Which SQL Server 2000 data type is better to increase performance and disk space?

like image 503
Victor Rodrigues Avatar asked Dec 18 '22 08:12

Victor Rodrigues


2 Answers

Do you need unicode or nonunicode data? Use either varchar(3000) or nvarchar (3000). Don't use text or ntext as they become problematic to query or update.

To design for average length makes no sense.

like image 127
HLGEM Avatar answered Jan 04 '23 00:01

HLGEM


If your field is going to hold up to 3000 characters, you should probably make sure your datatype will allow for something that big. Design based upon your maximum, not your average.

like image 26
TheTXI Avatar answered Jan 04 '23 00:01

TheTXI