We have reached the end of the course with the introduction of functions.
CREATE FUNCTION quick_example(@in_param VARCHAR(50)) -- passing a value into the function using parameter -- `@in_param` declared as a VARCHAR(50) RETURNS VARCHAR(50) AS BEGIN -- beginning of code do something when executing this -- function DECLARE @out_param VARCHAR(50) -- receive value from it has been processed, using -- the same data type (VARCHAR(50)) SET @out_param = CONCAT ( '`', @in_param, '` processed as `', UPPER(@in_param), '`' ) -- passing a value. the original value processed RETURN @out_param -- printing the value of the output parameter -- end of code to do something when executing this function END;
Download the class notes for day 9.