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

Write and execute a stored procedure - SQL Server Tutorial

From the course: Program Databases with Transact-SQL

Start my 1-month free trial

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…

Contents