sql - what is a stored procedure and in what sense its differenct than a simple one? -


i want know difference between "stored procedure" , simple one. stored procedures built-in?

a stored procedure nothing more prepared sql code save can reuse code on , on again. if think query write on , on again, instead of having write query each time save stored procedure , call stored procedure execute sql code saved part of stored procedure.

in addition running same sql code on , on again have ability pass parameters stored procedure, depending on need stored procedure can act accordingly based on parameter values passed.

benefits of using stored procedure

  1. one of main benefits of using stored procedure reduces amount of information sent database server. can become more important benefit when bandwidth of network less. since if send sql query (statement) executing in loop server through network , network gets disconnected, execution of sql statement doesn't return expected results, if sql query not used between transaction statement , rollback statement not used.
  2. compilation step required once when stored procedure created. after not require recompilation before executing unless modified , reutilizes same execution plan whereas sql statements need compiled every time whenever sent execution if send same sql statement every time.
  3. it helps in re usability of sql code because can used multiple users , multiple clients since need call stored procedure instead of writing same sql statement every time. helps in reducing development time.
  4. stored procedure helpful in enhancing security since can grant permission user executing stored procedure instead of giving permission on tables used in stored procedure.
  5. sometimes, useful use database storing business logic in form of stored procedure since makes secure , if change needed in business logic, may need make changes in stored procedure , not in files contained on web server.

for more info check codeproject & mssqltips


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -