sql-serverdbcc

Decipher SQL Server page storage


CREATE TABLE tbl
  (
     col1 VARCHAR(1)
  )

INSERT INTO tbl
VALUES     (NULL)

DBCC traceon(3604)

DBCC ind(0, tbl, -1)

DBCC page(0, 1, 290, 3) WITH tableresults /*Change page number as required*/

Output

PAGE HEADER:    Slot 0 Offset 0x60 Length 9 Record Type PRIMARY_RECORD
PAGE HEADER:    Slot 0 Offset 0x60 Length 9 Record Attributes    NULL_BITMAP
PAGE HEADER:    Slot 0 Offset 0x60 Length 9 Record Size 9
Slot 0 Offset 0x60 Length 9 Memory Dump @0x000000001646A060     
10000400 01000100 d8                          ........Ø

What is d8 here?


Solution

  • This is just padding,

    enter image description here

    The row only needs to take up the 7 bytes highlighted above (a null or empty varchar column at the end of the row needs no space) but the minimum row size is 9 bytes so you are seeing garbage from whatever was on the page before in the last two bytes.