/ (Divide) (Transact-SQL)

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

Topic link iconTransact-SQL Syntax Conventions

Syntax

dividend / divisor

Arguments

  • dividend
    Is the numeric expression to divide. dividend can be any valid expression of any one of the data types of the numeric data type category, except the datetime and smalldatetime data types.
  • divisor
    Is the numeric expression to divide the dividend by. divisor can be any valid expression of any one of the data types of the numeric data type category, except the datetime and smalldatetime data types.

Remarks

The actual value returned by the / operator is the quotient of the first expression divided by the second expression.

Result Types

Returns the data type of the argument with the higher precedence. For more information, see Data Type Precedence (Transact-SQL).

If an integer dividend is divided by an integer divisor, the result is an integer that has any fractional part of the result truncated.

Examples

The following example uses the division arithmetic operator to calculate the sales target per month for the sales people at Adventure Works Cycles.

USE AdventureWorks;
GO
SELECT SalesPersonID, FirstName, LastName, SalesQuota, SalesQuota/12 AS 'Sales Target Per Month'
FROM Sales.SalesPerson s 
    JOIN HumanResources.Employee e ON s.SalesPersonID = e.EmployeeID
    JOIN Person.Contact c ON e.ContactID = c.ContactID;

See Also

Reference

Data Types (Transact-SQL)
Functions (Transact-SQL)
Operators (Transact-SQL)
SELECT (Transact-SQL)
WHERE (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance