top of page

SSMS - Stored procedure (Save code for re-use)

If your query had to be run multiple times, the best way is to save a stored procedure.

Saving a procedure may also allow other users with appropriate access to: view, update, execute, and review your code. It's actually a very simple process, I hope the image below will give you insight on how it is done.

It does come with certain caveats. To be able to save a stored procedure, you will need the appropriate write access to the database / table. Because accidental update, execution, deletion, etc. might cause an irreparable damage to your table(s) as some queries are tied to other stored procedure.


E.g. You accidentally run a procedure that UPDATE, ALTER when it is not scheduled to be run until the 1st day of the month and inside it is calling for "today," and "today" happens to not be the 1st day of the month.


So please be very careful. Thanks and good luck.

0 comments

Recent Posts

See All

Comments


bottom of page