Alecs
Alecs

Reputation: 2316

Display deleted rows T-SQL

Help, please. Is there any other way to display deleted rows in SQL Server except for using trigger and deleted table or writing SELECT before DELETE with the same WHERE clause?

Upvotes: 5

Views: 2544

Answers (1)

Mikael Eriksson
Mikael Eriksson

Reputation: 138960

You can use the output clause of the delete statement.

delete from yourtable 
output deleted.*
where ...

Upvotes: 20

Related Questions