jestges
jestges

Reputation: 3740

Can we get Altered stored procedure

Hi by mistake I've altered one stored procedure and is there any chance to get that old procedure?

Thank you

Upvotes: 0

Views: 521

Answers (2)

HLGEM
HLGEM

Reputation: 96570

There is no reason whatsoever to not put your database in source control and treat it like any other code. You should NEVER make a change to a database without a source control script. This means never ever using the GUI to make database changes.

The only way to get back what you replaced is to restore a backup or if you have the other version on a another server, then script it and re-run on the server you you changed.

Yes fixing your source control problem is an emergency, you and your team should not write anymore code of any kind until this is done.

Upvotes: 1

Dan
Dan

Reputation: 905

Restore a backup of the affected database onto another server to get the old procedure's code, then copy just that code over.

If you don't have a spare server, you can restore the database to a different database on the same server. (create a new database, then restore the backup to that - just pay attention that you're restoring onto your new/temporary database, then delete that database when you're finished)

Red-Gate has SQL log rescue which might have helped (it's for SQL2000), but there might be other solutions available.

Upvotes: 0

Related Questions