Code Library
Home Submit Free Hosting Link To Us Contacts

SQL Delete from heap

SQL Delete from heap SQL SQL Delete from heap Download (.zip)



USE pubs
go
if exists (SELECT * FROM sysobjects where name='smallrows' and type='U')
             DROP TABLE smallrows
go
CREATE TABLE smallrows
(a int identity,
 b char(10))
go
INSERT INTO smallrows 
 VALUES ('row 1') 
INSERT INTO smallrows 
 VALUES ( 'row 2')
INSERT INTO smallrows  
 VALUES ( 'row 3')
INSERT INTO smallrows  
 VALUES ( 'row 4')
INSERT INTO smallrows  
 VALUES ( 'row 5')
go
SELECT first FROM sysindexes WHERE id = object_id ('smallrows ')
go
DBCC TRACEON(3604)
go
/* Replace 248 by whatever page number you got. */
DBCC PAGE(pubs, 1, 248, 1, 1)
go



DELETE FROM smallrows  
WHERE a = 3
go
DBCC PAGE(pubs, 1, 248, 1, 1)
go






Tatet