Often yes, if a copy exists
Is it possible to recover permanently deleted data? Sometimes. The answer depends on which copies of the data exist and when they were made, not on which command removed the rows. SQL Server has no recycle bin for rows or tables, so a committed DELETE, TRUNCATE TABLE, or DROP TABLE takes effect in the table right away.
Where the data may still exist
- Backups. Full, differential, and log backups taken before the change. A point-in-time restore needs the full backup, any differential backup after it, and the log backups up to the moment you want.
- The transaction log. Records of the change may still be in the log if they haven’t been cleared. A log backup taken now can capture them, as long as the database is online and uses the full or bulk-logged recovery model.
- History and change capture. Temporal history tables, change data capture tables, and audit triggers can all keep old values.
- Other copies. An export, a restored backup, or a database on another server that was copied before the change. A replica usually applies the delete too, so a live replica won’t help. An older copy can.
When recovery is unlikely
- The database uses the simple recovery model, and no backup was taken before the change.
- Backups have expired or were never kept.
- The database was dropped, and no backup or copy exists.
- Many writes have happened since the change, which can make the old data harder to find.
What to do first
- Stop writes to the database if you can.
- If the database uses the full recovery model and is online, take a log backup now.
- Restore to a copy under a new name, then copy back the rows that are missing.
The step-by-step details are in how to recover deleted data from sql server database.
Azure SQL Database
Azure SQL Database keeps point-in-time restore data for seven days by default. You can set the window from 1 to 35 days, and Basic databases are limited to 7 days. A deleted database can be restored on the same logical server, to its deletion time or an earlier point within that window. If you set up long-term retention, older backups may also be available.