Difference between writing SQL query and stored procedure ?

Answers were Sorted based on User's Feedback



Difference between writing SQL query and stored procedure ?..

Answer / ramneet

SP is good for security purpose, as it grant privileges to
the use.........

Is This Answer Correct ?    23 Yes 20 No

Difference between writing SQL query and stored procedure ?..

Answer / shivangi rastogi

in sql query,there is not security features since when we
write a query in our programe,through ildasm command it
will show thw query to the public.
in stored procedure,we named a set of query & it works as a
file name whenever anyone checks the query it ll find the
procedure name not that query onwhich our programe is
running.
in sql query,if any error in query it ll compiled & show
error at runtime,which is not in stored procedure.

Is This Answer Correct ?    8 Yes 5 No

Difference between writing SQL query and stored procedure ?..

Answer / anbu arunmozhi

Query execute every time when ever u call that statement
but stored procedure execute only one time v can used every time it should be very efficient compare query

Is This Answer Correct ?    3 Yes 0 No

Difference between writing SQL query and stored procedure ?..

Answer / tmp

the main advantages is Execution Plan Retention and Reuse (SP are compiled and their execution plan is cached and used again to when the same SP is executed again)
http://blog.sqlauthority.com/2007/04/13/sql-server-stored-procedures-advantages-and-best-advantage/

Is This Answer Correct ?    0 Yes 0 No

Difference between writing SQL query and stored procedure ?..

Answer / komal sankhe

compared with sql query, stored procedure is efficient and
timesaving execution.Because stored procedure is program
once it formed then execute as a program at the same
time.coz queries are taking the time

Is This Answer Correct ?    19 Yes 22 No

Post New Answer

More SQL Server Interview Questions

Explain what are the authentication modes in sql server?

0 Answers  


Hi All, I want to display all duplicate records in the table. My query has to fetch all the records which are duplicate(First Name or Last Name). Also I want the ability to also pull names where there might be a middle initial placed in the end of the first name field, (i.e., "Maria Z. " vs. "Maria") as well. Please guide me to find this. Table: ID FirstName LastName 1 Zach H Hoffman 2 Zach Hoffman 3 Troy Hoffman 4 Shawn Livermore 5 Prem S 6 Jony Hoffman H 7 Zach Modan I need the query to filter......... ID FirstName LastName 1 Zach H Hoffman 2 Zach Hoffman 3 Troy Hoffman 6 Jony Hoffman H 7 Zach Modan I hope this example will give you clear idea..... Thanks in Advance Prem

2 Answers  


Explain basic SQL queries with SELECT from where Order By, Group By-Having?

3 Answers   TetraSoft, Wipro,


What is a transaction and why is it important?

0 Answers  


we have emp table like Ename,EDOJ,EDOB with Column structure.but we want to know the employee Age.How? Any Body Plz

6 Answers  






What are the differences between stored procedure and the dynamic sql?

0 Answers  


Is sql server a database?

0 Answers  


Your company has 50 branches all over the country all the branches, including the head office have sql server as the database every night all 50 branches upload certain information to the head office which replication topology is best suited for the above scenario?

0 Answers  


how can we know that how many users are connected in perticuler server??????

2 Answers  


Which are the olap features?

0 Answers  


How to create new databases with "create database" statements?

0 Answers  


What does REVERT do in SQL Server 2005?

0 Answers   HCL,


Categories