SQL Server DELETE Examples

DELETE - Row

Delete a row of data. 

BEGIN TRANSACTION
GO

DELETE FROM [dbo].[ClassRegistration]
WHERE      classes_num  = 2  
       AND seat_num     = 12  
GO

COMMIT TRANSACTION
GO

DELETE - Multiple rows of data

Delete multiple rows of data. Be careful!

BEGIN TRANSACTION
GO

DELETE FROM [dbo].[ClassRegistration]
WHERE   seat_num     >= 12  
GO

COMMIT TRANSACTION
GO
 Collapse All    Expand All
Custom Search

SQL Server Information and Resources