Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 494
  • Last Modified:

scalar function

Hi experts, i a readng about scalar function, but i don't understand the difference between
Inline ad Multi-statement (please give me a transanct code)
0
enrique_aeo
Asked:
enrique_aeo
  • 2
  • 2
1 Solution
 
Kevin CrossChief Technology OfficerCommented:
That shouldn't matter for scalar functions. You should check the MSDN book online regarding CREATE FUNCTION and should clear this up for you as "scalar" functions are those that are returning a single value and so typically you are doing multiple lines of code and returning a specific value. Table functions are typically referred to as inline or multi-statement. See MSDN for the difference there, but think about singular SQL queries versus those needing multiple lines.
0
 
enrique_aeoAuthor Commented:
I was reading about Table functions are typically referred to as inline or multi-statement, but i do not understand, for that reason I ask is help and better if with transact sql code
0
 
Kevin CrossChief Technology OfficerCommented:
Okay, above you indicated "scalar" so it threw me off ... I gave you the hint though: "think about singular SQL queries versus those needing multiple lines." If you have a query that is a single select statement then you can simply return it "inline" to the return clause of the function definition. If you need variables or other multi-line constructs, then you will want to define that the function returns a table and then build the table up over the function body and then return final select.
0
 
enrique_aeoAuthor Commented:
perfect man
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now