PERCENTILE_CONT 和 PERCENTILE_DIST 怎么可能是不确定的?

How can PERCENTILE_CONT and PERCENTILE_DIST be non-deterministic?

根据 MSDN 文档:PERCENTILE_CONT (Transact-SQL),这两个函数都是不确定的。

这两个函数怎么会是非确定性的呢?有什么例子吗?

排序顺序可能有联系,在这种情况下,顺序通常在 SQL 服务器中未定义。

在您发布的页面上,您可以找到link到另一个页面:

Deterministic and Nondeterministic Functions

明确说明的地方:

All aggregate functions are deterministic unless they are specified with the OVER and ORDER BY clauses. For a list of these functions, see Aggregate Functions (Transact-SQL).

这就是为什么 PERCENTILE_CONT 是不确定的。它使用 ORDER BY 子句,这可能是不确定性的来源,如果你没有唯一地指定这个原因,即会有联系 - 不能保证绑定的记录将以相同的方式排序每次尝试订购时。