Quiero realizar una función para calcular la antigüedad de un empleado se me ocurrió lo siguiente
create function fn_AntiguedadEMpleado (@ID int)returns int
as
begin
declare @antiguedad int
select @antiguedad = DATEDIFF(year, emp.HIRE_DATE,SYSDATETIME)
from test.EMPLOYEES emp
where emp.ID=@ID
return @antiguedad
end;
Pero me da error el SYSDATETIME