Uploaded on

Functions creation in sql

Functions creation in sql

More in: Education , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
119
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
4
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 2. TOPIC Function creation in SQL Server
  • 3. What is Function A function is a set of Instruction that performs a specified task, which Repeatedly occur in the main Program.
  • 4. • A Function is also Stored Block of code similar to a Procedure. • A Function is a Block of Code which will return only a single value. • A Function can be used in a Select Statement. • Try and Catch Statements cannot be used in the Functions.
  • 5. Types of Function • 1) System Defined Function • 2) User Defined Function
  • 6. 1) System Defined Function These functions are defined by Sql Server for different purpose. We have two types of system defined function in Sql Server - Scalar Function Scalar functions operates on a single value and returns a single value. - Aggregate Function Aggregate functions operates on a collection of values and returns a single value.
  • 7. 2) User Defined Function These functions are created by user in system database or in user defined database. three types of user defined functions. - Scalar Function User defined scalar function also returns single value as a result of actions perform by function.
  • 8. Scalar Function
  • 9. • Inline Table-Valued Function User defined inline table-valued function returns a table variable as a result of actions perform by function. The value of table variable should be derived from a single SELECT statement.
  • 10. Inline Table-Valued Function
  • 11. • Multi-Statement Table-Valued Function User defined multi-statement table-valued function returns a table variable as a result of actions perform by function. In this a table variable must be explicitly declared and defined whose value can be derived from a multiple sql statements
  • 12. Multi-Statement Table-Valued Function
  • 13. THE END Create by Shafi
  • 14. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550