From the course: Complete Guide to Advanced SQL Server
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Stored procedure input parameters - SQL Server Tutorial
From the course: Complete Guide to Advanced SQL Server
Stored procedure input parameters
Like functions, stored procedures can include input parameters to alter the actions that the stored procedure performs. Unlike functions and views, though, stored procedures can write data to our existing tables rather than just returning existing values. Let's take a look at both capabilities by exploring the data and adding rows to the Wide World Importers' Warehouse.Colors table. Let's first take a look at its current content by selecting everything from Warehouse.Colors, and I'm going to order by the ColorID descending. This table has five columns, but to add a new row, we only need to supply values for the first three. The ValidFrom and ValidTo columns are automatically populated by SQL Server since this is a system version or a temporal table that keeps a record for when rows are added and modified. So let's focus on the first three columns. The ColorID is the primary key for the table. Integer values here are all one larger than the previous row. Notice that the highest value…
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
-
-
-
-
-
Write and execute a stored procedure7m 43s
-
(Locked)
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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-