Can we create a function in SQL Server to be deterministic and precise without CLR?
CREATE FUNCTION ufn_max_smalldatetime ()
RETURNS SMALLDATETIME
WITH SCHEMABINDING
AS
BEGIN
RETURN CAST('2079-06-06' AS SMALLDATETIME)
END
Can we create a function in SQL Server to be deterministic and precise without CLR?
CREATE FUNCTION ufn_max_smalldatetime ()
RETURNS SMALLDATETIME
WITH SCHEMABINDING
AS
BEGIN
RETURN CAST('2079-06-06' AS SMALLDATETIME)
END
As far as I know SQL Server determines itself whether your function is deterministic and/or precise. Try running the following queries and see what you get:
SELECT OBJECTPROPERTYEX(OBJECT_ID('dbo.ufn_max_smalldatetime'), 'IsDeterministic')
SELECT OBJECTPROPERTYEX(OBJECT_ID('dbo.ufn_max_smalldatetime'), 'IsPrecise')