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
⇒ Passing Expressions to Function Parameters in SQL Server
⇐ Creating User Defined Functions with Parameters in SQL Server
2016-12-18, 2889🔥, 0💬
Popular Posts:
What is sqlservr.exe - Process - SQL Server (SQLEX?PRESS) in SQL Server? Process sqlservr.exe is the...
How To Connect to a MySQL Server with a Port Number in MySQL? If you want to connect a MySQL server ...
How to download and install the scaled-down database AdventureWorksLT in SQL Server? If you want to ...
How to run Queries with SQL Server Management Studio Express in SQL Server? 1. Launch and connect SQ...
What Are the Basic Features of a Trigger in SQL Server? Since a SQL Server trigger is a really an ev...