Print Page | Close Window

nvarchar length

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=21084
Printed Date: 28 March 2026 at 7:54am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: nvarchar length
Posted By: zMaestro
Subject: nvarchar length
Date Posted: 20 August 2006 at 3:56am
sorry for this newbie questions...
In mssql, does the 'length' referee to the max size of this field?
i.e. if a column is nvarchar, i set its length to 250
does this means it only holds 250 characters?
 
and why the ntext is set by default to 16?
 
thanks.



Replies:
Posted By: jeffdaro
Date Posted: 20 August 2006 at 6:11am
These are two different datatypes. In your first question, yes 250 characters is the max for THAT varchar you specified. If you made the same field in char, you'd get a 250 character field, with the spaces padded on the end of the data to fill out to 250 characters. So char is great for something like a simple zip code that will always be 5 characters, but it would be awful for say a city name since they could be any range of sizes, so you'd use varchar.

nText is the unicode version of a text field. Text fields are much like varchar but handle a lot more data.

Check out http://www.databasejournal.com/features/mssql/article.phpr/2212141 - this article , which explains the basics of the SQL datatypes pretty well.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net