Learn more about SQL Server tools


Tutorials          DBA          Dev          BI          Career          Categories          Events          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Events

DBA    Dev    BI    Categories


SQL Server Stored Procedure Tutorial


A stored procedure is nothing more than prepared SQL code that you save so you can reuse the code over and over again.  So if you think about a query that you write over and over again, instead of having to write that query each time you would save it as a stored procedure and then just call the stored procedure to execute the SQL code that you saved as part of the stored procedure.

In addition to running the same SQL code over and over again you also have the ability to pass parameters to the stored procedure, so depending on what the need is the stored procedure can act accordingly based on the parameter values that were passed.

Take a look through each of these topics to learn how to get started with stored procedure development for SQL Server.

You can either use the outline on the left or click on the arrows to the right or below to scroll through each of these topics.


More SQL Server Solutions

Post a comment or let the author know this tip helped you.

All comments are reviewed, so stay on subject or we may delete your comment.

*Name    *Email    Notify for updates 

Note: your email address is not published. Required fields are marked with an asterisk (*)

Get free SQL tips:

*Enter Code refresh code     

Thursday, January 28, 2016 - 8:35:36 AM - Greg Robidoux Back To Top

@bhavsinh, when you setup parameters to be passed to a stored procedure you specify the data type, so that is step one in validating the type of input that is passed.  You can then write logic within the stored procedure to further validate the data and then take different paths in the stored procedure based on the the logic you write. 

Look at this for passing parameters: https://www.mssqltips.com/sqlservertutorial/162/how-to-create-a-sql-server-stored-procedure-with-parameters/

You can also use If logic in your stored procedure.  Take a look at this: https://msdn.microsoft.com/en-us/library/ms182717.aspx




Thursday, January 28, 2016 - 3:22:49 AM - bhavsinh Back To Top

hello sir,

in stored Procedure how to give validation by user input

Learn more about SQL Server tools