please dont rip this site

Comparison Predicate

The comparison predicate uses arithmetic operators to compare column data to a literal value. For a row to be selected, the predicate must evaluate to TRUE. (Index Server queries that use such predicates are called relational property queries.)

Syntax

Column_Reference Arithmetic_Operator Literal [ Boolean_Operator Column_Reference Arithmetic_Operator Literal ... ]

Elements

Column_Reference  Specifies the column name (alias). Its data type must be compatible with the format of the literal specified.
  
Arithmetic_Operator  

Specifies the arithmetic operator to use to compare the column reference data to a literal value. The following table lists the operators with examples.

Operator Symbol Example
Equals = WHERE DocAuthor = 'Isaac Asimov'
Not equals != or <> WHERE DocTitle != 'Finance'
Less than < WHERE WordCount < 1000
Greater than > WHERE WordCount > 500
Less than or equal to <= WHERE WordCount <= 500
Greater than or equal to >= WHERE WordCount >= 500
  
Literal  

Specifies a constant data value that complies with the constraints of its data type. The following literal types are supported:

Basic String

The basic string literal can be an ANSI string constant, or a Unicode string constant. Since strings are surrounded by single quotes, to specify a quote character as part of the string, use two single quotes. An empty string is denoted by ''. Examples:

'One Fine Day'
'Rosemary''s Baby'
 

Exact Numeric

An exact numeric literal can be an integer or a number with a decimal point. When an exact numeric literal is an integer, it can be one, two, four, or eight bytes in size. Examples:

-300              (2 byte integer)
67000           (4 byte integer)
5000000000 (8 byte integer)
.55
-366.12
 

Approximate Numeric

An approximate numeric literal is composed of a mantissa and a signed or unsigned exponent. Examples:

2.5 E-5
-.5E20
 

Hexadecimal

A hexadecimal literal is an integer expressed in hexadecimal notation. The hexadecimal expression has to be prefixed with "0x". Example:

0x2F456
 

Boolean

A boolean literal can only have the values TRUE or FALSE.
 

Absolute Date/Time

The absolute date/time literal can be expressed as a date string or as a timestamp string. Note that the "/" (slash) and the "-" (dash) are interchangeable.

Examples:

'1996/01/25'
'1996/01/25 02:05:00'
'1996-02-28 10:59:03'
Note: The Index Server engine requires dates to be in terms of file times based on Greenwich Mean Time (GMT).
 

Relative Date/Time

The relative date/time literal expresses a date relative to the current date.

The syntax for the DATEADD() function is:

DATEADD( Time,  Relative_Interval,
{ Relative_Date/Time | GETGMTDATE()) }
Time has the following values:
  • year or yy
  • quarter or qq
  • month or mm
  • day or dd
  • week or wk
  • hour or hh
  • minute or mi
  • second or ss

The GETGMTDATE() function is modelled after the GETDATE() function in SQL Server, but GETGMTDATE() indicates the current Greenwich Mean Time rather than the current time on the local machine.

Use the following format to specify the relative date/time:

For example, to express an Index Server relative time value of -2 years, enter:

DATEADD(year, -2, GETGMTDATE())
To express a relative time value of - 3 years, 24 days, and 5 hours, enter:
DATEADD(hh, -5, DATEADD(dd, -24, DATEADD(yy, -3, GETGMTDATE())))
Note: Positive (future) dates are not supported. The Index Server engine requires dates to be in terms of file times based on Greenwich Mean Time (GMT).
 

NULL

A NULL literal is an undefined literal.

Note: When determining if a literal is defined or not, use IS and IS NOT instead of the equals operator ( = ).
 

  
Boolean_Operator  Specifies the boolean operator to use, following the precedence rules previously stated, that combines the comparison predicates.

Examples

  1. The following example returns all the files that have the phrase Financial Data as the title of their document.

    ...WHERE DocTitle = 'Financial Data'
  2. The following example returns all the files that have the phrase Financial Data as the title of their document or that have John James as the author.

    ...WHERE DocTitle = 'Financial Data' 
       OR DocAuthor = 'John James'
  3. The following example returns all the files that have a size less than 10,0000 or a word count less than or equal to 800.

    ...WHERE size < 10000
       OR DocWordCount <= 800

  4. © 1997 by Microsoft Corporation. All rights reserved.


    file: /Techref/language/asp/ix/ixsecmp.htm, 9KB, , updated: 1997/10/1 01:56, local time: 2024/7/17 01:20,
    TOP NEW HELP FIND: 
    3.138.119.68:LOG IN

     ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
    Please DO link to this page! Digg it! / MAKE!

    <A HREF="http://techref.massmind.org/techref/language/asp/ix/ixsecmp.htm"> SQL Access to Index Server Data: Comparison Predicate</A>

    After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


    Link? Put it here: 
    if you want a response, please enter your email address: 
    Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
    Did you find what you needed?

     

    Welcome to massmind.org!

     

    Welcome to techref.massmind.org!

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

      .