From the course: Microsoft SQL Server 2022 Essential Training
Unlock this course with a free trial
Join today to access over 24,100 courses taught by industry experts.
Leverage user-defined scalar functions - SQL Server Tutorial
From the course: Microsoft SQL Server 2022 Essential Training
Leverage user-defined scalar functions
- [Instructor] If you find that you're processing a column of data in the same way on a regular basis and there isn't a built in function to do the work for you, then you can often simplify the process by creating your own custom scaler function. Scaler functions is just a fancy way of saying a function that returns a single value. Most of SQL servers built in functions are scaler. The count function, for example, doesn't matter how many records you feed into it, it will always return just a single number. In the Wide World Importer's database, there is a table that I want to take a look at. It's all the way down at the very bottom in the warehouse schema. It's called Warehouse.VehicleTemperatures. Let's create a new query to take a look at the raw data that the table contains. I'll just select everything from the table. Make sure you're targeting the Wide World Importers database, and press execute. Now, this table…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
Create a view of the data8m 33s
-
(Locked)
Data table indexes3m 49s
-
(Locked)
Create additional indexes on a table2m 52s
-
(Locked)
Aggregate functions7m 14s
-
(Locked)
Use built-in functions5m 15s
-
(Locked)
Leverage user-defined scalar functions7m 12s
-
(Locked)
Introduction to stored procedures3m 58s
-
(Locked)
Create stored procedures5m 34s
-
(Locked)
Parameterized stored procedures4m 42s
-
-
-
-
-