A stored procedure is a group of Transact-SQL statements compiled into a single execution plan.
In simple terms Stored Procedures are a Group of queries which runs simultaneously based on their call , SP are capable of doing complex queries with easily manageable structure with Looping , Conditions , functions etc .
Stored Procedures are a batch of SQL statements that can be executed in a couple of ways. Most major DBMs support stored procedures; however, not all do. You will need to verify with your particular DBMS help documentation for specifics.To create a stored procedure the syntax is fairly simple:CREATE PROCEDURE . AS So for example:CREATE PROCEDURE Users_GetUserInfo@login nvarchar(30)=nullASSELECT * from [Users]WHERE ISNULL(@login,login)=login
When we write a query again and again then we write that query as a stored procedure and we call that stored procedure name.
A SP is a group of sql statement for perform some job in database. To use SP at the place of query is very good and som ADV also..SP is fast then Query.. Security...example:creare procedure student (@name varchar(50) ) as begin select * from student_master where name=@name end