Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jgeurts
Starting Member
2 Posts |
Posted - 2008-02-19 : 12:41:42
|
Is it bad form to use nvarchar(MAX) in place of column types with specific lengths like nvarchar(50)? Are there performance issues? Because to me (a novice), it appears that I would save space by using nvarchar(MAX) everywhere. Same question applies to varbinary(MAX) as well.ThanksJim_______________Jim GeurtsPersonal: http://www.biasecurities.comWork: http://propertycenteronline.com |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-02-19 : 13:28:17
|
Why do you think you would save space?CODO ERGO SUM |
 |
|
jgeurts
Starting Member
2 Posts |
Posted - 2008-02-19 : 14:18:55
|
quote: Originally posted by Michael Valentine Jones Why do you think you would save space?
I think my knowledge of how nvarchar(50) worked was wrong. I assumed that it allocated 50 characters regardless of the size, but I suppose that the varchar part makes it variable size as well, up to a max of 50 characters. If that is the case, it makes me wonder the benefit of setting a limit of characters rather than just using MAX. Does the nvarchar(MAX) data type take up more space than nvarchar(50) if you're using less than 50 characters with your character data? If not, what benefit is there to using nvarchar(50) over nvarchar(MAX)?_______________Jim GeurtsPersonal: http://www.biasecurities.comWork: http://propertycenteronline.com |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-02-19 : 14:34:22
|
nvarchar(max) uses more space for internal pointers and is stored on a different DB page by default. Also, it cannot be an indexed column.CODO ERGO SUM |
 |
|
|
|
|