Tuesday 25 September 2012

What is stored procedure ? What are the advantages using stored procedure in sql server

Hi friend, here i have explained about store procedure in sql server.

What is stored procedure:

Stored procedure is a group of sql statements that has been created and stored in the database.It is a pre-compiled sql query.It will accept input parameters so that a procedure can be used over the network by several clients using different input data. It reduce network traffic and increase the performence. if we modify the stored procedure all the clients will get the updated stored procedure.

sample of creating stored procedure:

create procedure procedure_name
(
@column_name1 datatype,
@column_name2 datatype,
@column_name3 datatype,
@column_name4 datatype
)
as begin
select * from table_name;
end;

Advantages of stored procedure:

1)stored procedure allows moduler programming.
You can create the procedure once,store in the database ,and call it many number of time in your program.

2)stored procedure allows faster execution.
  because it is precompiled sql query.

3)It reduces the network traffic.

4)Stored procedure provide the better security to your data.

There are three types of stored procedure:
a)system  stored procedure
b)user defined stored procedure
c)Extened stored procdure

No comments:

Post a Comment

Note: only a member of this blog may post a comment.