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 .
A stored procedure is a group of Transact-SQL statements compiled into a single execution plan.
Posted May 13, 2015, 6:52 AM
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)=null
AS
SELECT * from [Users]
WHERE ISNULL(@login,login)=login
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