JOG
JOG

Reputation: 5640

If I change nvarchar(30) to nvarchar(256), when is the disk space allocated?

We have got a big table with hundreds of thousands of rows, and say, 20, columns. One of the columns is of type nvarchar(30). If I change this to nvarchar(256), because a few of the rows need to store more data there, but not all, then:

I tried to google this but only found comparisons of nvarchar(n) with nvarchar(MAX). Please note that my scenario does not include out-of-row storage, as far as I can tell.

Upvotes: 0

Views: 1360

Answers (1)

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239664

That should be a metadata only change - rows only consume as much storage for variable length data as they actually require. So an nvarchar(256) column where no row actually contains more than 30 characters will consume exactly as much disk space as an nvarchar(30) column.

Upvotes: 2

Related Questions