我想使计算列保持不变,但TRY_PARSE使我的函数不确定。我可以做点什么吗?有替代品吗?
CREATE FUNCTION [dbo].[F]
(
@input nvarchar(100)
)
RETURNS int
WITH SCHEMABINDING
AS
BEGIN
return TRY_PARSE(@input as INT)
END
SELECT OBJECTPROPERTY(OBJECT_ID('[dbo].[F]'), 'IsDeterministic')
答案 0 :(得分:1)
改为使用TRY_CONVERT
:
CREATE FUNCTION [dbo].[F]
(
@input nvarchar(100)
)
RETURNS int
WITH SCHEMABINDING
AS
BEGIN
return TRY_CONVERT(INT,@input)
END
SELECT OBJECTPROPERTY(OBJECT_ID('[dbo].[F]'), 'IsDeterministic')