我们可以在没有CLR的情况下在SQL Server中创建一个确定性和精确的函数吗?
CREATE FUNCTION ufn_max_smalldatetime ()
RETURNS SMALLDATETIME
WITH SCHEMABINDING
AS
BEGIN
RETURN CAST('2079-06-06' AS SMALLDATETIME)
END
答案 0 :(得分:1)
据我所知,SQL Server自行确定您的功能是确定性的还是精确的。尝试运行以下查询,看看你得到了什么:
SELECT OBJECTPROPERTYEX(OBJECT_ID('dbo.ufn_max_smalldatetime'), 'IsDeterministic')
SELECT OBJECTPROPERTYEX(OBJECT_ID('dbo.ufn_max_smalldatetime'), 'IsPrecise')