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.
Write and execute a stored procedure - SQL Server Tutorial
From the course: Program Databases with Transact-SQL
Write and execute a stored procedure
- [Instructor] After views and user defined functions the next step up in programmability object capabilities is a stored procedure. Stored procedures can perform many of the same tasks as views and functions. They can perform select queries against the database, just like a view. They can also take input parameters like a function. What sets them apart is that store procedures can perform multiple tasks in a single routine and they can modify the data that's stored in your database. To create and manage stored procedures, you'll use the same create, alter or drop syntax that we use for other objects inside of the database. Just like a function and a view, you'll name the procedure using a two part naming convention that'll place it in a specific schema of the database. Here I'm creating a stored procedure inside of the application schema of the wide world importers database. I'm going to call this procedure uspViewEmployees. Now we haven't talked about naming conventions in this…
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
-
-
-
-
-
(Locked)
Write and execute a stored procedure7m 43s
-
Stored procedure input parameters7m 38s
-
(Locked)
Stored procedure output parameters3m 38s
-
(Locked)
Create a database trigger3m 37s
-
(Locked)
Challenge: Use function in a stored procedure1m 25s
-
(Locked)
Solution: Use function in a stored procedure7m 43s
-
(Locked)
-
-
-
-