/****************************************************
AboutSQLServer.com blog
Written by Dmitri Korotkevitch

Insert/Update pattern
2010-11-28
*****************************************************/
set nocount on
go

create table dbo.Data
(
	Id int not null identity(1,1),
	PreprocessingData char(75) null
		constraint DEF_Data_PreprocessingDataPlaceholder
		default 'Just the placeholder. Think about multiple fields',

	PostProcessingData varchar(50) null,
	 
	constraint PK_Data
	primary key clustered(ID)
)
go

declare
	@I int
select @I = 0

begin tran
	while @I < 10000
	begin
		insert into dbo.Data default values
		select @I += 1
	end
commit
go

-- checking statistics on the index
select 
	page_count, 
	avg_fragmentation_in_percent, 
	avg_page_space_used_in_percent,
	* 
from sys.dm_db_index_physical_stats(
	DB_ID(),
	OBJECT_ID(N'Data'),
	null, 
	null,
	'DETAILED'
	)
go

/* Assuming you have processing routine that updates nullable field(s) in the table */
update dbo.Data 
set PostProcessingData = Replicate('A',50)
go 

-- checking statistics on the index
select 
	page_count, 
	avg_fragmentation_in_percent, 
	avg_page_space_used_in_percent,
	* 
from sys.dm_db_index_physical_stats(
	DB_ID(),
	OBJECT_ID(N'Data'),
	null, 
	null,
	'DETAILED'
	)
go

-- Workaround: 
truncate table dbo.Data
go

declare
	@I int
select @I = 0

begin tran
	while @I < 10000
	begin
		insert into dbo.Data(PostProcessingData)
		values(REPLICATE(' ',50))
		
		select @I += 1
	end
commit
go

-- checking statistics on the index
select 
	page_count, 
	avg_fragmentation_in_percent, 
	avg_page_space_used_in_percent,
	* 
from sys.dm_db_index_physical_stats(
	DB_ID(),
	OBJECT_ID(N'Data'),
	null, 
	null,
	'DETAILED'
	)
go

/* Assuming you have processing routine that updates nullable field(s) in the table */
update dbo.Data 
set PostProcessingData = Replicate('A',50)
go 

-- checking statistics on the index
select 
	page_count, 
	avg_fragmentation_in_percent, 
	avg_page_space_used_in_percent,
	* 
from sys.dm_db_index_physical_stats(
	DB_ID(),
	OBJECT_ID(N'Data'),
	null, 
	null,
	'DETAILED'
	)
go