From the course: Developing Microsoft SQL Server 2016 Databases
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Add parameters to a stored procedure - SQL Server Tutorial
From the course: Developing Microsoft SQL Server 2016 Databases
Add parameters to a stored procedure
- [Instructor] Stored procedures are a great way to simplify and consolidate the process of passing instructions to the database, but it's important to ensure that you're being efficient with their use. What you don't want is to create a thousand stored procedures that each address a single use case. Maintenance and your sanity will be greatly improved by finding opportunities to create stored procedures that serve a variety of functions. One of the main ways to doing this is by utilizing parameters that alter the procedure scope. These parameters can be specified by the end user at run time so that a single stored procedure can serve up results to a variety of situations. To see this in action, I'm going to switch into the WideWorldImporters database and then we'll create a new stored procedure with a parameter. To do that, we start just like normal with a CREATE PROCEDURE clause and then the name of the procedure.…
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.