Hello everyone, I am going to share the code sample for create sql functions . Table of Contents Add returns type like varchar, int etc. Declare the return variable. Add the T-sql statements to compute the return value. Return the result of the function. The example for the same as given below. CREATE FUNCTION [dbo] . [fun_GetOrderType] ( @Return SMALLINT , @Reprocess SMALLINT , @Cancel SMALLINT ) RETURNS VARCHAR ( 10 ) AS BEGIN -- DECLARE THE RETURN VARIABLE HERE. DECLARE @type VARCHAR ( 10 )= 'XYZ' -- ADD THE T-SQL STATEMENTS ...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers