Get a demonstration of how to create your own functions and an example of when that is useful.
- [Instructor] If you find that the built-in functions…don't meet your needs,…you can create your own function.…These are called user-defined functions.…I've staged some code for us that's going to do just that.…If you open up the exercise files…and copy all of that into a new query window,…you'll see we're using the keyword create…and the keyword function,…then the name of the function's going to be get email.…We'll pass one parameter to it called person name.…Then we have to specify what data type is going…to be returned by this function,…so I specified it returns a varchar of lith 250.…
We then have the logic for actually finding…an email address based on someone's name,…and then eventually we return that email address.…So I'll go ahead and click the execute button,…and we see command(s) completed successfully.…To find this function we'll look again in programmability,…open up functions in the scalar-valued function section.…I'll right click and hit refresh…and now we see dbo.getemail.…To demonstrate using this function,…
Author
Released
11/16/2016- Installing SQL Management Studio
- Using SQL Server Configuration Monitor
- Creating a database
- Creating tables with SMS and T-SQL
- Creating relationships between tables
- Creating views
- Writing queries to return XML
- Working with XML and JSON
- Backing up and restoring SQL Server
- Monitoring and management
- Security
- Performance
- Integrating SQL Server with cloud services like Azure
Skill Level Intermediate
Duration
Views
Related Courses
-
Database Foundations: Administration
with Adam Wilbert1h 14m Beginner -
Microsoft SQL Server 2014: Backup and Recovery
with Martin Guidry1h 22m Intermediate -
Learning Microsoft SQL Server 2016
with Adam Wilbert1h 21m Beginner
-
Introduction
-
Welcome1m
-
-
1. Overview of SQL Server 2016
-
SQL Server editions2m 22s
-
2. Installing SQL Server 2016
-
Basic installation6m 22s
-
-
3. Working with Tools
-
Activity Monitor3m 31s
-
Profiler4m 20s
-
4. Creating and Configuring Databases
-
Create a database3m 16s
-
Install a sample database3m 12s
-
-
5. Creating Tables in a Database
-
Create a table using T-SQL1m 41s
-
In-memory tables3m 34s
-
Temporal tables5m 19s
-
6. Creating Views in Databases
-
Create a view3m 17s
-
-
7. Understanding Programmability
-
Stored procedures3m 23s
-
Built-in functions1m 50s
-
Scalar functions2m 10s
-
-
8. Working with XML
-
Introduction to XML1m 29s
-
Write queries to return XML2m 38s
-
Shred XML2m 23s
-
Working with XML schemas1m 48s
-
Storing XML3m 38s
-
-
9. Working with JSON
-
Working with JSON2m 29s
-
Storing JSON2m 19s
-
-
10. Backup and Restore
-
Basic backups2m 32s
-
Basic restore2m 48s
-
11. Monitoring and Management
-
Audit logins2m 35s
-
12. Security
-
Instance-level logins2m 47s
-
Database-level users2m 24s
-
Encrypt data5m 24s
-
13. Performance
-
Basics of indexes3m 4s
-
Create an index6m 18s
-
Columnstore index3m 12s
-
Explore execution plans5m 1s
-
Overview of Query Store3m 18s
-
-
14. Cloud
-
Back up to Azure3m 9s
-
Set up Stretch Database4m 46s
-
Monitor Stretch Database1m 24s
-
-
Conclusion
-
Next steps33s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Scalar functions