Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Whats the difference between Query and Stocked procedure ?

user-image
Question ajoutée par Utilisateur supprimé
Date de publication: 2014/07/18
Shagufta Mubasher
par Shagufta Mubasher , Web Developer , MP CJ O Shopping Sdn. Bhd.

If you mean to say difference between a SQL query and SQL stored procedure, I am differentiating it below.

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 only1 statement. In Stored Procedure we can execute Batch of QueriesAdvantage 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.

 

P.S: by SP I mean Stored Procedures. If this is something actually suppose to differentiate query with stocked procedure, please discard my answer as I haven't heard that term before

 

Thanks

Thanks

DURGESH YADAV
par DURGESH YADAV , ASSISTANT PROGRAMMER , DISTRICT ELECTION OFFICE DEORIA

The diffrence between query and stocked procedure is:

Query: The phase that identifies an efficient execution plan for evaluating a query that has the least estimated cost is referred to as query optimization.

Stoked procedure: A stored procedure is a named group of SQL statements that have been previously created and stored in the server database.

Deva Gnanam Jayaseelan
par Deva Gnanam Jayaseelan , Lead SSE , MS

Query and stored procedure do the same thing but the difference is that a query should be compiled everytime 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.

More Questions Like This