MS SQL Server 2012 - DBA Articles

DELETE - Delete Existing Records with Conditional Data



DELETE statement is used to delete existing record(s) from a table. DELETE statement does not generate query result set. SELECT query must be run before and after DELETE statement to know the modified data values. The following queries are used to DELETE particular Product record from PRODUCT Table.

-- Example 25 --

 

SELECT * FROM Product

WHERE Prod_Code = 'PROD3'

 

DELETE FROM Product

WHERE Prod_Code = 'PROD3'

 

SELECT * FROM Product

WHERE Prod_Code = 'PROD3'


Query Output Screen

* * * * *


Email Your Comment To AUTHOR