Site icon Coding Faster

Using Stored Procedures In MSSQL

Today, I want to talk about using stored procedures in MsSql. First let me explain why we need Stored procedures. Stored procedure means, SQL statements that are kept in the database and compiled in the first run and do not need to be recompiled later. We will do it by procedures.

Procedures has a lot of advantages. Main one is it’s working very fast. Because it only compiles once and no need to compile again. And you can also use if else while operations in the stored procedures.

Let start creating a simple procedure.

We define a procedure which has a parameter. This parameter helps us to get the named users. And we will run this procedure by the following code.

That’s all so easy. You can create more complex procedures which has input parameters and output parameters.  Procedures are especially very useful for your reporting requirements. If you are looking for triggers in MsSql, have a look at Triggers In MsSql

If you have question do not forget to write from the chat button next to it or from the comment.

Exit mobile version