Results 1 to 5 of 5

Thread: SP vs FUNCTION

  1. #1
    Join Date
    May 2004
    Location
    bangalore
    Posts
    270

    Unanswered: SP vs FUNCTION

    Hi,
    When we talk about the difference between SP and Function, it is said that Function returns a value where as SP doesn't. My Question is, Then what does the "OUTPUT" parameter Stands for in SP?
    Kindly make my doubts clear on this.


    Thanks In Adv.
    Rahul Jha

  2. #2
    Join Date
    Feb 2003
    Location
    India
    Posts
    216
    As a matter of fact both SP and Function can return or not return (return Null, void in other languages) values. But the basic difference is - a Function can be uses in an expression or as a part of expression where SP cannot be.

  3. #3
    Join Date
    Aug 2004
    Location
    Pune,India
    Posts
    94
    well, i would say something to add to above.
    SPs always return a resultset where as in a function we have to define the return type in advance.
    The OUTPUT parameters in SPs are nothing but the parameters passed by reference. The function will never accept any parameter defined as output parameter.

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Not to quibble, but SPs do not "always" return a result set.

    OK, I quibbled...
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I was accused of being pendantic....

    In any case, my prefered methods are sprocs....I find very little use for functions
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •