Arithmetic Operators (Transact-SQL)
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
Analytics Platform System (PDW)
SQL analytics endpoint in Microsoft Fabric
Warehouse in Microsoft Fabric
Arithmetic operators run mathematical operations on two expressions of one or more data types. They're run from the numeric data type category. For more information about data type categories, see Transact-SQL syntax conventions.
Operator | Meaning |
---|---|
+ (Add) | Addition |
- (Subtract) | Subtraction |
* (Multiply) | Multiplication |
/ (Divide) | Division |
% (Modulo) | Returns the integer remainder of a division. For example, 12 % 5 = 2 because the remainder of 12 divided by 5 is 2. |
The plus (+) and minus (-) operators can also be used to run arithmetic operations on datetime and smalldatetime values.
For more information about the precision and scale of an arithmetic operation result, see Precision, Scale, and Length (Transact-SQL).
See Also
Mathematical Functions (Transact-SQL)
Data Types (Transact-SQL)
Expressions (Transact-SQL)
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho