SQL Page split

Page split

/* First create the table */
USE pubs
go

if exists (SELECT * FROM sysobjects where name='bigrows' and type='U')
	DROP TABLE bigrows
go

DROP TABLE bigrows
go
CREATE TABLE bigrows
(a int  primary key,
 b varchar(1600))
go
/* Insert five rows into the table */
INSERT INTO bigrows 
 VALUES (5, replicate('a', 1600)) 

INSERT INTO bigrows 
 VALUES (10, replicate('b', 1600)) 

INSERT INTO bigrows 
 VALUES (15, replicate('c', 1600)) 

INSERT INTO bigrows 
 VALUES (20, replicate('d', 1600)) 

INSERT INTO bigrows 
 VALUES (25, replicate('e', 1600)) 

go
SELECT first FROM sysindexes WHERE id = object_id ('bigrows')
go
/* Convert the value returned to a decimal by byte-swapping and then doing a hex-to-decimal conversion on the last four bytes. See Chapter 6 for details. For our example, we'll assume the converted value is decimal 249. You should replace 249 with whatever page number you get. */

DBCC TRACEON(3604)
go
DBCC PAGE(pubs, 1, <page #>, 1, 1)
go


INSERT INTO bigrows 
 VALUES (822, replicate('x', 1600)) 
go
DBCC PAGE(pubs, 1, <page #>,1,1)
go