After using delete statement in sql query to delete some
records...to retrieve the deleted records we can get using
rollback command but till that where it stores means
particular location name i need....(after deleting and
rollback )
Answers were Sorted based on User's Feedback
Answer / nagesh
wen we are performing DML operations into table . 2 magic
tables created in the memory i.e., in Master Database.
Names of the 2 tables
1) INSERTED
2) DELETED
When we insert any record then that record will be added
into this Inserted table initially, similarly while
updating a record a new entry will be inserted into
Inserted table & old value will be inserted into Deleted
table.
In the case of deletion of a record then it will insert
that record in the Deleted table
when we call rollback command the deleted record retrieved
from Deleted table. Once committed we can't call rollback.
| Is This Answer Correct ? | 18 Yes | 5 No |
Answer / saravanan p
When we delete the records using triggers only the deleted
records will be stored in deleted table.
But if we do delete using begin transaction, the deleted
records will be stored in transaction log file. We cannot
see it visually.
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / imran
SQL Server keeps log for each deleted records. you can
query these logs via 'fn_dblog' sql server function.
Select [RowLog Contents 0] FROM sys.fn_dblog(NULL, NULL)
WHERE AllocUnitName = 'dbo.TableName' AND Context IN
( 'LCX_MARK_AS_GHOST', 'LCX_HEAP' ) AND Operation in
( 'LOP_DELETE_ROWS' )
But this log is in Hex format. and you need to convert this
Hex format to your actual data.
Given below is the article that can help you to recover the
deleted records in the same way defined above.
http://raresql.com/2011/10/22/how-to-recover-deleted-data-
from-sql-sever/
| Is This Answer Correct ? | 3 Yes | 1 No |
How to delete all rows with truncate table statement in ms sql server?
Is sql server 2016 free?
What is row_number()?
If I delete a template from the list in sql studio, will it be deleted from the hard disk? : sql server management studio
What happens if you insert a duplicate key for the primary key column in ms sql server?
How to view existing indexes on an given table using sp_help?
How to a Query to copy data from on table to another table.
Write down the syntax and an example for create, rename and delete index?
What is the contrast between sql and pl/sql?
What is updatable resultset?
How to get the query of a table in sql server?
I have Two table First have UserName and second is address, in address table more than value relegated to UserName table, i want to fetch 2nd address if exist other wise 1st address access
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)