Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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 / ashwini

SQL query will be compiled everytime it is executed.
Stored procedures are compiled only once when they are
executed for the first time.

Is This Answer Correct ?    209 Yes 18 No

Difference between writing SQL query and stored procedure ?..

Answer / gayathri

Every query is submited it will be compiled & then
executed.where as stored procedure is compiled
when it is submitted for the first time and this compiled
content is stored in something called procedure cache,
for subsequent calls no compilation,just execution & hence
better performance than query.
In Query we can execute only 1 statement. Stored Procedure:
In Stored Procedure we can execute Batch of Queries

Is This Answer Correct ?    103 Yes 11 No

Difference between writing SQL query and stored procedure ?..

Answer / senthil kumar

compared with query, stored procedure is efficient and fast
execution.Because stored procedure is program once it
formed then execute as a program.

Is This Answer Correct ?    90 Yes 26 No

Difference between writing SQL query and stored procedure ?..

Answer / vial

stored proceure compiles only once and stores in database
managemant system so it is optimized for best performance
while sql query compiles every time and executes using dbms
driver so its performance decreses

Is This Answer Correct ?    77 Yes 21 No

Difference between writing SQL query and stored procedure ?..

Answer / robinson

The execution plan will be created when compiling the stored
procedure and permanently stored in the database and so it
is much efficient, But in the case of query the execution
plan will be created at runtime.

Is This Answer Correct ?    30 Yes 9 No

Difference between writing SQL query and stored procedure ?..

Answer / raghuraja, sivaganga, india

Advantage in Programming - If you are using Query in your
program exe, want to change Query, you have to change query
and compile it again. But if used Stored procedure, no need
to recompile just modify the sp. Query is slow and SP is
fast.

Is This Answer Correct ?    30 Yes 10 No

Difference between writing SQL query and stored procedure ?..

Answer / prakash

1. SP is easy to allocate GRANT AND REVOKE (Privileges)
Rights for user

2. SP is execute more faster than query statement

3. SP, is already compiled Object

4. Query is Sql Statement where as SP batch of Sql Statement

5. In a query memory management is more high than the SP

Is This Answer Correct ?    27 Yes 8 No

Difference between writing SQL query and stored procedure ?..

Answer / kshitij s. nirmaley

query and stored procedure do the same thing but the
difference is that a query should be compiled every time the
query is executed, while the stored procedure is in compiled
form when executed first time .If we use stored procedure
we can avoid recompilation of the query.

Is This Answer Correct ?    23 Yes 5 No

Difference between writing SQL query and stored procedure ?..

Answer / pratap

A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.
CREATE PROCEDURE procedure_name
@param data_type = default_value,
@param data_type = default_value,
@param data_type = default_value
AS

BEGIN
DELETE FROM Employees
WHERE EmployeeId = @EmployeeId;
END

Is This Answer Correct ?    13 Yes 0 No

Difference between writing SQL query and stored procedure ?..

Answer / swathi

Queries are compiled each and evey time when we execute.
where as Stored Procedures are compiled only once when we
execute for the first time and the execution plans are
cached in memory.

Is This Answer Correct ?    9 Yes 3 No

Post New Answer

More SQL Server Interview Questions

How can we improve performance by using SQL Server profiler?

0 Answers   QuestPond,


Explain multiserver query

0 Answers  


How to genrate automaticlly empid like gt001

4 Answers  


Do you know what is lock escalation?

0 Answers  


Can multiple columns be used in sql group by clause in ms sql server?

0 Answers  


What is standby servers? Explain types of standby servers.

0 Answers  


How to link up the text file to a Database table?

2 Answers   Allianz,


Your sql server is running out of disk space. You notice that there are several large files with ldf extensions what are these files?

0 Answers  


What do you understand by recursive stored procedures?

0 Answers  


what is the purpose of creating view is sql server 2000

13 Answers   Wipro,


What is the difference between dbcc indexdefrag and dbcc reindex?

0 Answers  


Is there any difference between the primary key and unique key?

0 Answers  


Categories