Objective: how to
create function and then call in SQL Query in SQL Server 2008
Click rc->SVF->New Scaler
value Function
CREATE
FUNCTION AddTwoNumber
(
-- Add the parameters for the function here
@A
INT,@B
INT
)
RETURNS
INT
AS
BEGIN
-- Declare the return variable here
DECLARE @Result As
INT
-- Add the T-SQL statements to compute the return
value here
SELECT @Result =
@A+@B
-- Return the result of the function
RETURN @Result
END
GO
Now
see how I call this function in SQL QUERY
SELECT
dbo.AddTwoNumber(2,2)