我们可以在SQL Server确定性和精确的创建标量值的功能?(Can we create scal

2019-10-17 04:10发布

我们可以在SQL Server中创建一个功能是确定的,不准确的CLR?

CREATE FUNCTION ufn_max_smalldatetime ()
RETURNS SMALLDATETIME
    WITH SCHEMABINDING
AS 
    BEGIN
        RETURN CAST('2079-06-06' AS SMALLDATETIME)
    END

Answer 1:

据我所知,SQL Server确定自身的功能是否是确定性的和/或精确。 尝试运行以下查询,看看你会得到什么:

SELECT OBJECTPROPERTYEX(OBJECT_ID('dbo.ufn_max_smalldatetime'), 'IsDeterministic')

SELECT OBJECTPROPERTYEX(OBJECT_ID('dbo.ufn_max_smalldatetime'), 'IsPrecise')


文章来源: Can we create scalar valued function in SQL Server as deterministic and precise?