If you are executing a specific SQL query very often, it would be usefully to have it as Stored Procedure on the SQL Server.
Stored Procedures is a collection of SQL statements.
There are 2 ways to create a store procedure:
- In the SQL Server Management Studio – you can right click on Stored Procedures and chose to create a new Stored Procedure. It will then create a template for you, which you just have to fill out and execute
- The second way is to build a script by yourself