views:

183

answers:

3

I have modified a stored procedure today but after that I realised that it is wrong. So I want revert it back. Is there any way to get the previously modified stored procedure or else last date's stored procedure.I dont have any back up also. pls reply soooooon.

Thanks n regards.

Imthiyaz

+4  A: 

Not directly within SQL Server. Unless you have kept a script in source control or elsewhere your only option is to restore an older backup to another environment and script out the old version from that.

ConcernedOfTunbridgeWells
I dont have neither backup to restore nor a script in the souce control........
You're pretty much buggered then. If that is the case you will have to reconstruct the previous version by hand.
ConcernedOfTunbridgeWells
+3  A: 

No, unless the SSMS query window you used to alter the procedure still has the old text in its undo buffer. You must restore a backup copy and manually transfer the procedure from database copy. You shouldn't be updating the database directly, but use a version controlled script instead to start with.

In future you can also install tools like the SSMS Toolpack that keep a history of every query you've run.

Remus Rusanu
A: 

Have you any backups of the database itself? The stored procedure is part of the database. Restore it onto a spare machine and extract it from there.

If you don't have a backup of the database... huh???

Marc Gravell