Forum Discussion
SQL Server :- Showing Incorrect DataType for nvarchar Bug
Hi Community,
Thanks for your time, this discussion is related to a bug or can say issue which i faced while working on SQL Server.
Issue Details -
On looking any tables schema thought
Right Click on Table Name -> Select Design i get this details
But when i use Alt + F1 getting details which are not matching to previous one
Columns with nvarchar datatype, length is not matching.
2nd step is giving wrong details (Always doubling the length), data from 1st step is correct schema of table.
Is anybody else facing same issue or is there any specific reason behind this, just wanted to know the reason.
For more details, i am using
Thanks for time & consideration.
- NamitaMehtaCopper Contributor
okay... i got my answer
"A common misconception is to think that NCHAR(n) and NVARCHAR(n), the n defines the number of characters. But in NCHAR(n) and NVARCHAR(n) the n defines the string length in byte-pairs (0-4,000). n never defines numbers of characters that can be stored."
Ref - https://docs.microsoft.com/en-us/sql/t-sql/data-types/nchar-and-nvarchar-transact-sql?view=sql-server-ver15
But i will suggest that Microsoft should maintain the consistence, as with different steps getting different details which is creating confusion. Just a suggestion.
Thanks!