Posted: Sun Jul 23, 2006 11:36 am Post subject: Re: Mod under SQL Server
It works for, end-to-end. It parses on Designer and runs on FC (see attachment). It looks like you have some code error on your object definition. Can you post what is the data element is in the db, the exactly code on designer, including data type? What "Number" does mean? A placeholder for an integer object or the exactly code you are using? Please note that SQL Server only accepts integer as operand with modulo operator.
(From SQL Server Online Help):
Provides the remainder of one number divided by another.
dividend % divisor
Is the numeric expression to divide. dividend must be any valid Microsoft® SQL Server™ expression of the integer data type category. (A modulo is the integer that remains after two integers are divided.)
Is the numeric expression to divide the dividend by. divisor must be any valid SQL Server expression of any of the data types of the integer data type category.
The modulo arithmetic operator can be used in the select list of the SELECT statement with any combination of column names, numeric constants, or any valid expression of the integer data type category.
This example returns the book title number and any modulo (remainder) of dividing the price (converted to an integer value) of each book into the total yearly sales (ytd_sales * price).
CAST((ytd_sales * price) AS int) % CAST(price AS int) AS Modulo
WHERE price IS NOT NULL and type = 'trad_cook'
ORDER BY title_id