Code Library
Home Submit Free Hosting Link To Us Contacts

SQL Delete from clustered table

SQL Delete from clustered table SQL SQL Delete from clustered table 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 primary key,
 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
DELETE FROM smallrows  
WHERE a = 3
go
/* Replace 253 with whatever page number you got */
DBCC PAGE(pubs, 1, 253,1,1)
go






Tatet