Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

- (Subtract) (SQL Server Compact Edition)

Subtracts two numbers. This subtraction arithmetic operator can also subtract a number, in days, from a date.

expression - expression


Any valid expression in Microsoft SQL Server 2005 Compact Edition of any of the data types of the numeric data type category, except the bit data type.

Returns the data type of the argument with the higher precedence.

The following example uses the subtraction arithmetic operator to get the number of days between the time a customer placed an order and when the order was shipped.

SELECT (DATEPART(day, ShippedDate) - DATEPART(day, OrderDate)) FROM Orders WHERE OrderID = '10248'
--The value returned is '12'.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft