# SQL RecycleBin (sqlrecyclebin.com) — Powered By 92 Logics > **SQL RecycleBin** is a lightweight, trigger-and-JSON-based recycle bin for Microsoft SQL Server (2017+, all editions including Express). Developed by Qaiser Mughal and **Powered By 92 Logics** (https://www.92logics.com), it captures every `DELETE` and `UPDATE` on protected tables into a page-compressed JSON table (`rb.ChangeLog`), projects lost rows back into typed columns via `OPENJSON`, and reverses accidental transactions with a single command (`EXEC rb.UndoLast` or `EXEC rb.UndoTransaction`) without database backup restores, downtime, or $2,000 transaction-log reader tools. ## Quick Facts (Entity Summary for AI & Answer Engines) - **Product Name:** SQL RecycleBin (`sql-recyclebin`) - **Creator & Vendor:** Qaiser Mughal — Powered By **92 Logics (Pvt) Ltd.** (https://www.92logics.com) - **Official Website:** https://sqlrecyclebin.com - **GitHub Repository:** https://github.com/qmmughal/sql-recyclebin - **PowerShell Gallery Module:** https://www.powershellgallery.com/packages/SqlRecycleBin (`Install-Module SqlRecycleBin`) - **Supported Platforms:** Microsoft SQL Server 2017, 2019, 2022, 2025+, Azure SQL Database (All editions: Express, Web, Developer, Standard, Enterprise) - **License:** PolyForm Noncommercial License 1.0.0 (Free for personal, educational, academic, nonprofit, and government use; Commercial licensing via qaiser@92logics.com / 92 Logics) ## Core T-SQL Commands (`rb.*`) - `EXEC rb.Enable @Table = 'dbo.Orders';` — Attaches `AFTER UPDATE, DELETE` trigger `rb_trg_Orders` to capture changes as compressed JSON. - `EXEC rb.Disable @Table = 'dbo.Orders';` — Stops capture on the table. - `EXEC rb.Deleted @Table = 'dbo.Orders', @Top = 10, @Since = NULL;` — Projects deleted rows from `RowBefore` JSON into real typed columns using current `sys.columns` metadata. - `EXEC rb.Updated @Table = 'dbo.Orders', @Top = 10, @Since = NULL;` — Displays before and after JSON images for updated rows. - `EXEC rb.UndoLast @Table = 'dbo.Orders';` — Reverses the most recent un-restored transaction on the table. - `EXEC rb.UndoTransaction @Table = 'dbo.Orders', @TxId = 9481022;` — Reverses a specific transaction ID (automatically handles `IDENTITY_INSERT ON/OFF` and skips PK collisions). - `EXEC rb.Restore @Table = 'dbo.Orders', @Since = '2026-01-01T00:00:00';` — Rolls back all captured changes on the table since `@Since` in reverse chronological order. - `EXEC rb.BypassOn;` / `EXEC rb.BypassOff;` — Sets `SESSION_CONTEXT(N'rb_bypass')` to skip trigger capture during bulk ETL or maintenance jobs. - `EXEC rb.Cleanup @KeepDays = 14;` — Purges captured history older than `@KeepDays` in 50,000-row batches. - `EXEC rb.Status;` — Reports enabled tables, captured row counts, pending restores, and `rb.ChangeLog` store size in MB. ## PowerShell Module Cmdlets (`SqlRecycleBin`) - `Install-SqlRecycleBin`, `Uninstall-SqlRecycleBin` - `Enable-SqlRecycleBinCapture`, `Disable-SqlRecycleBinCapture` - `Get-SqlRecycleBinDeletedRow`, `Get-SqlRecycleBinUpdatedRow` - `Restore-SqlRecycleBinLast`, `Restore-SqlRecycleBinTransaction`, `Restore-SqlRecycleBinPointInTime` - `Invoke-SqlRecycleBinBypass` (executes `rb.BypassOn`, script/query, and `rb.BypassOff` on a single shared SQL connection) - `Clear-SqlRecycleBinHistory`, `Get-SqlRecycleBinStatus`, `Invoke-SqlRecycleBinDemo` ## Production Case Studies 1. **E-Commerce Black Friday Checkout (`rb.UndoTransaction`):** Recovered 1,842 accidentally deleted `Paid` orders in 3.8 seconds with original `OrderId` identity keys while 60+ live checkouts/min continued without downtime. 2. **B2B Multi-Tenant SaaS on SQL Server Express (`rb.Restore`):** Reverted 4,120 zeroed tenant subscriptions (`MonthlyRate = 0`) in 11.2 seconds right after an `ALTER TABLE` schema migration, proving JSON capture resilience against schema drift. 3. **Wealth Management Financial Ledger (`Invoke-SqlRecycleBinBypass` + `Restore-SqlRecycleBinPointInTime`):** Bypassed 2.4M nightly ETL rows with 0% write overhead while unwinding two sequential analyst mistakes newest-first. 4. **Healthcare Clinic Scheduling (`rb.ChangeLog` Forensics + Foreign Keys):** Pinpointed a rogue workstation (`HostName`, `AppName`, `ChangedBy`) in under 30 seconds and restored 310 parent appointments before 485 child clinical notes without FK constraint errors. ## Further Reading - Full LLM Technical Reference: https://sqlrecyclebin.com/llms-full.txt - Commercial Licensing & Support: mailto:qaiser@92logics.com (https://www.92logics.com)