Scripting stored procedures automatically

  • I have a database, let's call it ABC, that has some stored procedures that I want to script automatically every night.  They are easy to identify because I start the name of each procedure with a common, unique, id such as JDG_sp_my_procedure (JDG are my initials).

    I want to create a stored procedure that will script each of my custom stored procedures each night and output the script to a file on our backup server.

    I know I could just script them when I create, or change, them but I sometimes get busy (or lazy?) and I don't create the scripts when I modify them.  Building this procedure would allow me to always have a current copy of my procedures whether I got busy (?) or not.

    This is all part of a disaster recovery plan I am working on for my company.

    Thanks for all input.

    Jason

    ----------------------------------------------------------01010011010100010100110000100000010100110110010101110010011101100110010101110010001000000101001001101111011000110110101101110011

  • Thank you, that was exactly what I was looking for.  I knew I had seen it somewhere before but I guess my search criteria wasn't good enough because I couldn't find it.

    The only thing I am curious about is why you have SELECT Top 5 name in the cursor query.  This is only going to give you the first 5 SPs, in alphabetical order.

    Thanks again!

    ----------------------------------------------------------01010011010100010100110000100000010100110110010101110010011101100110010101110010001000000101001001101111011000110110101101110011

Viewing 3 posts - 1 through 2 (of 2 total)

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