从 SQL Server 2016 到版本 2019,功能发生了一些变化。
这是测试功能:
create function [dbo].[TestFunction]
(
@input uniqueidentifier
)
returns uniqueidentifier
as
begin
select top 0 @input = id from randomTable;
return
(
select @input
)
end
如果我在 SQL Server 2016 中尝试此代码,结果是输入值,但在 SQL Server 2019 中,结果为空。
有人可以指出我改变的正确方向吗?