Mr.Nois
Mr.Nois

Reputation: 35

What is the purpose of DELETED Table in MSSQL

So far, i know that:

  1. There is a Table called DELETED in my MSSQL Database.
  2. I have not created that Table which means it already existed.

Is there a similar Table called UPDATED?

Upvotes: 0

Views: 3635

Answers (2)

Gordon Linoff
Gordon Linoff

Reputation: 1270401

There is not a deleted table in SQL Server. There are "logical tables" (I think of them more like views, but the implementation is not important) called deleted and inserted that are available in triggers and other operations that alter data in tables.

An update trigger defines both of them.

This is pretty well explained in the documentation.

Upvotes: 6

parfilko
parfilko

Reputation: 1454

you can see example of using DELETED and INSERTED logical tables in the MERGE statement:

https://learn.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql

Upvotes: 0

Related Questions