Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
 BETWEEN (SQL Server Compact)

  Switch on low bandwidth view
Other versions are also available for the following:
SQL Server Compact 3.5 Service Pack 1 Books Online
BETWEEN (SQL Server Compact)

Specifies a range to test.

test_expression [ NOT ] BETWEEN begin_expression AND end_expression
test_expression

The expression to test for in the range defined by begin_expression and end_expression. The test_expression must be the same data type as both begin_expression and end_expression.

NOT

Specifies that the result of the predicate be negated.

begin_expression

Any valid expression in Microsoft SQL Server Compact 3.5 (SQL Server Compact 3.5). The begin_expression must be the same data type as both test_expression and end_expression.

end_expression

Any valid expression in SQL Server Compact 3.5. end_expression must be the same data type as both test_expression and begin_expression.

AND

Acts as a placeholder indicating that test_expression should be within the range indicated by begin_expression and end_expression.

bit

BETWEEN returns TRUE if the value of test_expression is greater than or equal to the value of begin_expression and less than or equal to the value of end_expression.

NOT BETWEEN returns TRUE if the value of test_expression is less than the value of begin_expression or greater than the value of end_expression.

To specify an exclusive range, use the greater than (>) and less than (<) operators. If any input to the BETWEEN or NOT BETWEEN predicate is NULL, the result is UNKNOWN.

The following example identifies products in a database with 35 or fewer units in stock.

SELECT [Product ID], [Product Name] FROM Products WHERE [Units In Stock] BETWEEN '0' AND '35'
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker