How to Execute T-SQL Upon Server Shutdown

  • Lynn Pettis (11/25/2008)


    Based on your earlier posts, I also assume that the records are fairly narrow, would you say under 128 bytes each?

    Definately. This table is as you say very narrow.

    Kindest Regards,

    Just say No to Facebook!
  • You haven't answered the other question yet, is it possible to capture the data in these tables when SQL Server restarts?

  • Lynn Pettis (11/25/2008)


    Didn't say there was a way to capture that info on shut down, it was an analogy to what you are trying to accomplish. Also, I just reread a post just before mine. Can you capture the data in the tables prior to them being reset? How is the reset accomplished, by the application when restarted, is it a truncate or delete, or whatever?

    I didn't say that you did I only asked if there was already something like this for the DMV's.

    Can the data be captured? Realistically, no. The data in the table is sometimes DELETE and somtimes just reset to all 0's via na UPDATE, and it is up to the application (and God only knows what logic it uses) to perform either a DELETE or an UPDATE which resets the values to 0.

    The application we use is not open and short of what Profiler can capture we have no knowledge of the internal workings of any part of the product. We can't even get a half decent dictionary of the database so as to undertsand what goes where. The names used for tables & columns does help but only soo much.

    Kindest Regards,

    Just say No to Facebook!
  • Lynn Pettis (11/25/2008)


    You haven't answered the other question yet, is it possible to capture the data in these tables when SQL Server restarts?

    Lynn - I was in the process of replying to your prior question.

    I appreeciate any and all replies but if your gonna just be pushy like this I'd rather not get your help.

    Kindest Regards,

    Just say No to Facebook!
  • We got bear with each other. I am try to help while also doing my own job as well (along with the normal day to day distraction that occur).

    one idea - If you have a test environment, you could see if a startup stored procedure could capture the data before the application starts.

    second idea - combined with a startup stored procedure that processes the data from a "mirrored-set" of tables, run a scheduled job every minute that copies the data from the applications tables to the "mirrored-set".

    third idea - still researching if there is an event that can be used to do the copies. Haven't found anything yet.

    Now that all my questions have been answered, if I find more about the third option, I'll let you know.

  • You cannot force SQL to execute on shutdown, especially if someone uses SHUTDOWN WITH NOWAIT to force an instant shutdown.

Viewing 6 posts - 16 through 21 (of 21 total)

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