'MOD' is not a recognized built-in function name

China☆狼群 提交于 2019-11-30 07:59:15

The MOD keyword only exists in the DAX language (tabular dimensional queries), not TSQL

Use % instead.

Ref: Modulo

In TSQL, the modulo is done with a percent sign.

SELECT 38 % 5 would give you the modulo 3

for your exact sample, it should be like this.

DECLARE @m INT
SET @m = 321%11
SELECT @m

It can be done using % operator. i.e. SELECT 50 % 5

If using JDBC driver you may use function escape sequence like this:

select {fn MOD(5, 2)}

Result 1

select mod(5, 2)

SQL Error [195] [S00010]: 'mod' is not a recognized built-in function name.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!