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, 2398🔥, 0💬
Popular Posts:
How To Query Tables and Loop through the Returning Rows in MySQL? The best way to query tables and l...
How To Recover a Dropped Index in Oracle? If you have the recycle bin feature turned on, dropped ind...
How To Locate and Take Substrings with CHARINDEX() and SUBSTRING() Functions in SQL Server Transact-...
How To Drop a Stored Procedure in Oracle? If there is an existing stored procedure and you don't wan...
Is SQL Server Transact-SQL case sensitive? No. Transact-SQL is not case sensitive. Like the standard...