Revert Last Delete Statement on in SQL Mgmt Studio

  • I usually SELECT those "to-be-deleted" rows to check first.... if nothing wrong, then delete.

  • Jeffrey Williams 3188 (7/5/2012)


    GSquared (7/5/2012)


    Whenever I have to modify data in production, I start with "begin transaction" and end with "rollback", run the script, use OUTPUT to check the results, and, when I'm finally happy with the results, then and only then change "rollback" to "commit", and re-run.

    For particularly sensitive modifications - I will also create a backup table of either the whole table or the affected rows giving me the opportunity to recover/rollback the changes if necessary. This can be done using the OUTPUT statement - which is what I believe you are referring to.

    ditto

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • SQLRNNR (7/5/2012)


    Run this code and replace 'YourDBNameHere' with the name of the database you are working with

    DECLARE @DBName varchar(128)

    SET @DBName = 'YourDBNameHere'

    Select a.database_name,a.backup_start_date

    ,BackupPath = b.physical_device_name

    ,BackupSizeMB = a.backup_size/1024/1024

    ,CompressedBackMB = a.compressed_backup_size/1024/1024

    From msdb.dbo.backupset a

    INNER JOIN msdb.dbo.backupmediafamily b

    ON a.media_set_id = b.media_set_id

    Where a.type = 'D'

    And a.backup_start_date > GETDATE()-7

    And b.physical_device_name not like '{%'

    AND a.database_name = @DBName

    Order By a.database_name,a.backup_start_date

    In case it wasn't clear, the OP asked how to find the backup job and then the maint plan. Skipping all that to go direct to find the backup path.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply