Functions creation in sql

310 views

Published on

Functions creation in sql

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
310
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Functions creation in sql

  1. 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. 2. TOPIC Function creation in SQL Server
  3. 3. What is Function A function is a set of Instruction that performs a specified task, which Repeatedly occur in the main Program.
  4. 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. 5. Types of Function • 1) System Defined Function • 2) User Defined Function
  6. 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. 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. 8. Scalar Function
  9. 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. 10. Inline Table-Valued Function
  11. 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. 12. Multi-Statement Table-Valued Function
  13. 13. THE END Create by Shafi
  14. 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

×