Skip to content

Latest commit

 

History

History
78 lines (62 loc) · 3.24 KB

multiply-transact-sql.md

File metadata and controls

78 lines (62 loc) · 3.24 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic ms.custom f1_keywords helpviewer_keywords dev_langs monikerRange
* (Multiplication) (Transact-SQL)
* (Multiplication) (Transact-SQL)
rwestMSFT
randolphwest
03/15/2017
sql
t-sql
reference
ignite-2024
*_TSQL
*
* (multiply operator)
multiplication [SQL Server]
multiply operator (*)
TSQL
>=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric

* (Multiplication) (Transact-SQL)

[!INCLUDE sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw-fabricsqldb]

Multiplies two expressions (an arithmetic multiplication operator).

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

expression * expression  

Arguments

expression
Is any valid expression of any one 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, see Data Type Precedence (Transact-SQL).

Examples

The following example retrieves the product identification number, name, the list price and the new list price of all the mountain bicycles in the Product table. The new list price is calculated by using the * arithmetic operator to multiply ListPrice by 1.15.

-- Uses AdventureWorks  
  
SELECT ProductID, Name, ListPrice, ListPrice * 1.15 AS NewPrice  
FROM Production.Product  
WHERE Name LIKE 'Mountain-%'  
ORDER BY ProductID ASC;  
GO  

Examples: [!INCLUDEssazuresynapse-md] and [!INCLUDEssPDW]

The following example retrieves the first and last name of employees in the dimEmployee table, and calculates the pay for VacationHours for each..

-- Uses AdventureWorks  
  
SELECT FirstName, LastName, BaseRate * VacationHours AS VacationPay  
FROM DimEmployee  
ORDER BY lastName ASC;  

See Also

Data Types (Transact-SQL)
Expressions (Transact-SQL)
Built-in Functions (Transact-SQL)
Operators (Transact-SQL)
SELECT (Transact-SQL)
WHERE (Transact-SQL)
*= (Multiplication Assignment) (Transact-SQL)
Compound Operators (Transact-SQL)