Accidentally Overwrote Stored Procedure

  • No, I am in a test environment.

  • Michael L John (10/19/2016)


    Also, you aren't really doing work on a production system, are you??

    It's always good to reinforce this point. It's why, in the environment I work in, only privileged ID's can make changes in production, and those ID's are not capable of doing anything else, no email, no internet, nothing except permissions on a SQL server. We also use MS TFS and defined processes to move SQL code from dev to acceptance to production, all in a controlled and scripted manner.

  • If you are developing code then you are advised to use a source control system. Aside from not having the copy of the release code reside on your machine or the machine of whomever created the stored procedure in this particular case, a good practice, source control systems can alert you to problems with your script before deploying anywhere. Such is the case when you select a column that does not yet exist.

    ----------------------------------------------------

  • Just as an aside; I have got into the habit of using the "Script as create" instead of "Script as alter" or "Modify" options when looking at stored procedures, functions, etc. The reason is that what happened to you has happened to me - exactly once.

  • And invest in SQL Redgate's toolbelt: one of the best investments for moving code between environments and managing source code control in SQL. Not affiliated, just a happy customer.

  • Chris Wooding (10/27/2016)


    Just as an aside; I have got into the habit of using the "Script as create" instead of "Script as alter" or "Modify" options when looking at stored procedures, functions, etc. The reason is that what happened to you has happened to me - exactly once.

    I do the same thing as a safety net.

  • Lynn Pettis (10/28/2016)


    Chris Wooding (10/27/2016)


    Just as an aside; I have got into the habit of using the "Script as create" instead of "Script as alter" or "Modify" options when looking at stored procedures, functions, etc. The reason is that what happened to you has happened to me - exactly once.

    I do the same thing as a safety net.

    Especially true if your window is connected to a database source. In these situations I like to also "disconnect" from the source after scripting to a new editor window, just to leave no room for error.

    ----------------------------------------------------

  • That's a good idea. Thanks for this.

Viewing 8 posts - 16 through 22 (of 22 total)

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