Skip to content
Advertisement

‘MOD’ is not a recognized built-in function name

I wanted to use MOD function in SQL Server 2008R2 and followed this link but still got the message:

‘MOD’ is not a recognized built-in function name.

DECLARE @m INT
SET @m = MOD(321,11)
SELECT @m

Error:

Msg 195, Level 15, State 10, Line 2
‘MOD’ is not a recognized built-in function name.

Why I can’t use this function from the link above?

Advertisement

Answer

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

Use % instead.

Ref: Modulo

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement