This tutorial is just for you where we take a look at SQL Server Functions within 10 minutes!
SQL Function Types
In this tutorial we look at a number of functions, but do not cover the complete spectrum of what is available.
System Functions
Aggregate Functions
Table Valued Functions
Scalar Functions
Functions vs Stored Procedures
Where possible I have created a tutorial for each of these types of functions and have linked to them from the video to give you more of an overview.
What is a Function?
A SQL Server function is first and foremost a database object - as are stored procedures, tables, views etc. A function accepts input parameters, it will perform a task and then return you a result.
For example; you may have a function that calculates the percentage of a number ( as I have demoed in this video). You could call this function with two numbers and it would return the percentage difference of the two
What are the benefits of Functions?
Functions are really handy! Using the function scenario above I had lost count of the amount of times that I've needed to re-write the same bit of code over the years, it was far easier to use this code and contain it within a database function, that way its re-usable code. That is the biggest benefit, re-usable code that's easily maintained and called.
Limitations of Functions
SQL functions can't be called remotely - so by that they can't be called over a linked server and should only be called on the database server they designed to run on. This isn't covered within this tutorial but happy to go over that if people want to and can easily knock up a video demonstrating that.
Content
00:00 Intro
00:38 Scalar Functions
03:16 Table Valued Functions
06:05 Stored Procedures vs Functions
07:35 Aggregate Functions
Смотрите видео Learn SQL Functions in 10 Minutes | Easy SQL Tutorial онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь The SQL Guy 16 Июль 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 39 раз и оно понравилось людям.