Join Martin Guidry for an in-depth discussion in this video Creating a user-defined function, part of SQL Server: Triggers Stored Procedures and Functions.
Now I'd like to talk a little bit about functions, sometimes called user-defined…functions in SQL Server 2012.…I'm going to start off with creating a new function.…So very similar to creating a stored procedure.…We start off with the keyword CREATE and then the keyword FUNCTION.…And then we need to give a name, typical naming rules in play here.…After the name, you have to supply a list of parameters in parenthesis.…So we could list out as many parameters as we want.…
You also have the option to do zero parameters which if you'd like to do…zero parameters, you still have to put the empty parenthesis, which I will do here.…Next, we have to declare what type of data, this function is going to return.…Every function will return something and we don't at this point have to decide…the exact value we're returning,…but we do have to decide what data type you're going to return.…So are you going to return a date, a piece of text, a number?…You have to make that decision at this time.…
You type in the keyword RETURNS, plural, and I'll use an integer for this one.…
- Comparing triggers, functions, and stored procedures
- Installing and configuring SQL Server
- Creating a stored procedure
- Returning data using data sets
- Creating user-defined functions
- Using "after," "instead," and nested triggers
- Modifying existing stored procedures
- Implementing logging on DELETE
- Choosing between T-SQL and CLR
- Executing a stored procedure
- Passing parameters
Skill Level Advanced
1. Getting Started
2. Installing SQL Server
Configuring your environment4m 53s
3. Stored Procedures
4. User-Defined Functions
6. Putting It All Together
7. Using CLR Assemblies
8. Exploring an ASP.NET Web Application
Next steps1m 43s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.