Share via


Literals

A literal is a string of characters that represents a value in an SQL statement. Literals are used to compare column values or to specify search terms. SharePoint Portal Server search supports the following types of literals:

  • String literals are not limited in length, and can contain either American National Standard Institute (ANSI) or Unicode characters. String literals must be enclosed in single quotation marks. To include a single quotation mark inside a string literal, use two single quotation marks. An empty string can be represented as two consecutive single quotes ('').
  • Numeric literals can contain the digits 0-9, a period, and the letter E (or e). Numeric literals represent numbers, including positive and negative integers, decimal numbers, and currency values. Numeric literals can be defined by using scientific notation (for example, 2.3E-05). Do not enclose a numeric literal in single quotation marks, because in that case it is interpreted as a string literal and will be compared by using string comparison techniques. Currency values cannot contain currency symbols.
  • Hexadecimal literals can contain the digits 0-9 and the letters A-F and a-f. A hexadecimal literal represents an unsigned integer specified in hexadecimal notation. Hexadecimal literals must begin with 0x. The SQL-92 standard requires hexadecimal literals to be enclosed in single quotation marks; however, SharePoint Portal Server search does not support that notation.
  • Boolean literals represent logical values, and can be either TRUE or FALSE. Do not enclose a Boolean literal in single quotation marks, because in that case it is interpreted as a string literal.
  • Date literals represent specific dates, time stamps, or relative times, and are enclosed in single quotation marks. Dates must be in the form month/day/year, where the month, day, and year are numbers. The year must be specified with a four-digit value, for example, 2001. Time values must be in the form hours:minutes:seconds. Relative time syntax is based on the dateAdd function.