ilija veselica
ilija veselica

Reputation: 9574

SQL Server how to get last inserted data?

I ran a large query (~30mb) which inserts data in ~20 tables. Accidentally, I selected wrong database. There are only 2 tables with same name but with different columns. Now I want to make sure that no data is inserted in this database, I just don't know how.

Upvotes: 2

Views: 1234

Answers (2)

jack.mike.info
jack.mike.info

Reputation: 128

Best option go for Trigger

Use trigger to find the db name and table name and all the history of records manipulated

Upvotes: 0

Johan
Johan

Reputation: 76597

If your table has a timestamp you can test for that.

Also sql-server keeps a log of all transactions.

See: https://web.archive.org/web/20080215075500/http://sqlserver2000.databases.aspfaq.com/how-do-i-recover-data-from-sql-server-s-log-files.html

This will show you how to examine the log to see if any inserts happened.

Upvotes: 1

Related Questions