It is possible to recalculate row size in SQL Server 2008? Take this example:
declare @counter int
declare @statement nvarchar(max)
set @counter=0
drop table kua2
create table kua2(id int)
while @counter<307
begin
set @statement = N'alter table kua2 add id'+CAST(@counter as nvarchar(max))+N' nvarchar(max)'
exec (@statement)
set @statement = N'alter table kua2 drop column id'+CAST(@counter as nvarchar(max))
exec (@statement)
set @counter=@counter+1
end
alter index all on kua2 rebuild
dbcc cleantable (0,'kua2',0)
alter table kua2 add id0 int
alter table kua2 add id1 int
alter table kua2 add id2 int
alter table kua2 add id3 int
When I add id3 column, I got warning about 8060 bytes, but the table has only 5 int columns, it still count the dropped nvarchar(max) columns in row size.
The only thing that helps is recreate the table. But for several reasons I don't want to do that. Is there any way to tell the SQL Server to recalculate the row size somehow?
NULL_BITMAP
and if a row has a variable length section will still consume space in the column offset array.