/ (Divide) (T-SQL)

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

Syntax

dividend / divisor

Arguments
dividend
Is the numeric expression to divide. dividend can be any valid Microsoft® SQL Server™ expression of any 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 SQL Server expression of any of the data types of the numeric data type category except the datetime and smalldatetime data types.
Result Types

Returns the data type of the argument with the higher precedence. For more information about data type precedence, see Data Type 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.

Remarks

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

Examples

This example uses the division arithmetic operator to calculate the royalty amounts due for authors who have written business books.

USE pubs

GO

SELECT ((ytd_sales * price) * royalty)/100 AS 'Royalty Amount'

FROM titles

WHERE type = 'business'

ORDER BY title_id

See Also
Data Types SELECT
Expressions WHERE
Functions Operators

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.