#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2011
    Posts
    140
    Rep Power
    0

    Difference between a query and strored procedure


    Dear all

    can anybody solve the problem that what is the Difference between a query and strored procedure?

    Thanks & Regards
    Diya
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Query & Stored Procedure


    Hi,

    Query and Stored procedure both are same but,
    1.When you compile the code each and every time the compiler check the query where stored procedure first time checks and next time onward it will execute i.e(precompiled block of code stored procedure)
    2.During Execution Each and every query Its time taking where as storedprocedure Not Time taking

    3.In Query if you want to modify you want to edit the code , compile and Execute the code.where Stored procedure Just modify using Alter

    Regards,
    SUM
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Location
    Los Angeles, CA
    Posts
    15
    Rep Power
    0
    Store procedure will not compile again and again while simple Query compile each time and then execute.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2012
    Location
    USA
    Posts
    33
    Rep Power
    0
    Query and stored procedure do the same thing but the difference is that a query ought to be compiled every time the query is executed, while the stored procedure is in compiled form when executed first time. I f they use stored procedure they can avoid recompilation of the query.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Query and SP


    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

IMN logo majestic logo threadwatch logo seochat tools logo