diff between a function and a stored proc with a recompile option

  • Dear All

    i would like to know what is the difference between a "Function" and a "Stored Procedures with recompile option". are they both same?

     

    Thanks & regards

    Rajiv.

  • functions can be used in queries to return a value based on some parameter orwithout parameter

    but we cannot use stored procedures in queris

    <a href="http://www.websolsoftware.com"> For IT jobs click here</a>

    *Sukhoi*[font="Arial Narrow"][/font]

  • hey sukhoi

    thanx for the reply. apart from that reason there is no difference in "functions" and "stored proc with recompile option"?

    regards

    Rajiv.

  • Hi,

    A couple of other differences:

    Functions can't alter the state of the database, only retrieve data or perform calculations.

    Procedures can, i.e. update, inserts and deletes are allowed.

    Functions can be used as part of a select statement - procedures can't.

    Olav

     

  • Another nifty difference between Fn and SP  is table variables. You can't pass table variables into stored procs - *darnit* - but you *can* call a function that returns a table variable. . .

    ciao

    E

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply