[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 499
  • 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

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

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