Showing posts with label Microsoft SQL Server Scalar Valued Function. Show all posts
Showing posts with label Microsoft SQL Server Scalar Valued Function. Show all posts

Tuesday, 27 February 2018

Microsoft SQL Server Scalar Valued Function

Microsoft SQL Server Scalar Valued Function.

--Create scalar function to input the date and output the direction.
--this function input is string data type and output is also string data type.
create function returnCall(@date varchar(10))
returns varchar(50)
as
begin
declare @direction as varchar(50)
select @direction=direction
FROM [test].[dbo].[options ftse]
where @date=Product
return @direction
end


--write select query to return the direction by inputting the date.
--Note use dbo. before the function name.
select dbo.returnCall('01/02/18');

Inline image 1