Retrieve previous version of a stored procedure

末鹿安然 提交于 2020-01-15 03:23:09

问题


I have modified a stored procedure today but after that I realized 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 don't have any back up also. Thank you.


回答1:


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.




回答2:


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.




回答3:


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???



来源:https://stackoverflow.com/questions/1042984/retrieve-previous-version-of-a-stored-procedure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!