I have created an user defined functions in SQL server. Is it possible to call these function in select statement, just like any other built-in function?
Create function [dbo].[TIME_TO_SEC](@inputTime time)
returns INT
As
Begin
DECLARE @secDiff INT = datediff(second, '00:00:00', @inputTime)
return @secDiff;
end
Currently calling this as below:
DECLARE @ret int;
EXEC TIME_TO_SEC @inputTime='01:00:00'
select @ret;
I am attempting something as simple as:
select TIME_TO_SEC('01:00:00') from TimeTable
Is it feasible in SQL-server?