Collections:
Passing Values to User Defined Function Parameters in SQL Server
How To Provide Values to User Defined Function Parameters in SQL Server Transact-SQL?
✍: FYIcenter.com
If a user defined function is created with parameters, you need pass values to those parameters when calling the function with one of two formats listed below:
expression... function_name(value_1, value_2, ... value_n)...
The tutorial exercise below shows you how to pass values to function parameters:
USE FyiCenterData; GO DROP FUNCTION Welcome; GO CREATE FUNCTION Welcome(@url VARCHAR(40)) RETURNS VARCHAR(40) AS BEGIN RETURN 'Welcome to '+@url; END; GO PRINT 'Hi there, '+dbo.Welcome('dba.FYIcenter.com'); GO Hi there, Welcome to dba.FYIcenter.com PRINT 'Hi there, '+dbo.Welcome('dev.FYIcenter.com'); GO Hi there, Welcome to dev.FYIcenter.com
2016-12-18, 816👍, 0💬
Popular Posts:
How to execute statements in loops in SQL Server Transact-SQL? How to use WHILE ... loops? You can u...
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows,...
How To Convert Numeric Values to Integers in SQL Server Transact-SQL? Sometimes you need to round a ...
How Fixed Length Strings Are Truncated and Padded in SQL Server Transact-SQL? When the length of the...
What are DDL (Data Definition Language) statements for tables in SQL Server? DDL (Data Definition La...