Collections:
"CREATE FUNCTION" - Creating User Defined Functions in SQL Server
How To Create a Simple User Defined Function in SQL Server Transact-SQL?
✍: FYIcenter.com
If you want to create a simple user defined function, you can use the "CREATE FUNCTION" command with a statement block in a simple format as shown in below:
CREATE FUNCTION function_name() RETURNS data_type AS BEGIN statement_1; statement_2; ... statement_n; RETURN expression; END; GO
The following tutorial exercise shows you how to create a simple user defined function:
USE FyiCenterData; GO CREATE FUNCTION Welcome() RETURNS VARCHAR(40) AS BEGIN RETURN 'Welcome to FYIcenter.com'; END; GO PRINT dbo.Welcome(); GO Welcome to FYIcenter.com
2016-12-24, 819👍, 0💬
Popular Posts:
How To Change the Password for Your Own User Account in MySQL? If you want to change the password of...
How To Get a List of All Tables with "sys.tables" View in SQL Server? If you want to see the table y...
How To Format Time Zone in +/-hh:mm Format in SQL Server Transact-SQL? From the previous tutorial, y...
How To Select Some Specific Columns from a Table in a Query in SQL Server? If you want explicitly te...
What Happens If the Imported Table Already Exists in Oracle? If the import process tries to import a...