Table of contents
Collapse the table of content
Expand the table of content

/ (Divide) (U-SQL)

Michael Rys|Last Updated: 5/15/2018
4 Contributors

Divides one number by another (an arithmetic division operator).

Divide_Operator :=                                                                                       
    dividend '/' divisor.

Semantics of Syntax Elements

Return Type

Returns the data type of the argument with the higher precedence. If an integer dividend is divided by an integer divisor, the result is an integer that has any fractional part of the result truncated.


  • The examples can be executed in Visual Studio with the Azure Data Lake Tools plug-in.
  • The scripts can be executed locally. An Azure subscription and Azure Data Lake Analytics account is not needed when executed locally.

Divide with Numeric Types

@data = 
        ( VALUES
        ) AS T(aNumber);

DECLARE @val int = 5;

@result =
    SELECT 25 / 5 AS Int1,
           aNumber / 5 AS Int2,
           aNumber / @val AS Int3,
           aNumber / 3 AS truncatedResult,
           aNumber / 3.0 AS toDouble,
           aNumber / (int?)null AS intNull           
           // aNumber / 0 AS divideByZero  // will error
    FROM @data;

OUTPUT @result
TO "/ReferenceGuide/Operators/Arithmetic/Divide1.txt"
USING Outputters.Csv();

See Also

© 2018 Microsoft