From the course: Program Databases with Transact-SQL
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Table-valued user-defined functions - SQL Server Tutorial
From the course: Program Databases with Transact-SQL
Table-valued user-defined functions
- [Instructor] Unlike a scalar valued function that only returns a single value, a table-valued function returns an entire table, or more specifically a result set that's made up of columns and rows. In this regard , table- valued functions can act just like a view, but here's the difference. A table -valued function can include input parameters that modify the output. Let's take a look at some order data from the Wide World Importers database. I'm going to run the three select statements online six, seven, and eight to view some order details. This shows me that we have a sales order for a customer ID number 803, and taking a look in the sales that customer's table, I can see who that corresponds to it's this person here, Bala Dickson. I can also see that the order ID number two, included two line items, and I can see them both right here. Line ID number three, and line ID number six. For a joke mug, and a USB flash drive. So that's the structure of the data that we're going to work…
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.