Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dev:sql:functions:extract [2009/12/04 23:10]
tdo created
dev:sql:functions:extract [2012/10/26 14:28] (current)
Line 11: Line 11:
 Required. The date part that is to be extracted. See below for a complete list of date parts that can be used in this parameter. Click to see a list of valid datefield options. Required. The date part that is to be extracted. See below for a complete list of date parts that can be used in this parameter. Click to see a list of valid datefield options.
  
-<​code>​ +Valid datefield Options: 
-Valid datefield Options +^ Date_field ^ Description ^ 
-YEAR +| YEAR | | 
-MONTH +| MONTH | | 
-DAY +| DAY | | 
-HOUR +| HOUR | | 
-MINUTE +| MINUTE ​| | 
-SECOND  +| SECOND ​| | 
-W - Day of the week number (1-Sunday, 2-Monday)  +| W | Day of the week number (1-Sunday, 2-Monday) ​|  
-WW - Three-character day-of-week abbreviation (Sun, Mon)  +| WW | Three-character day-of-week abbreviation (Sun, Mon) | 
-WWW - Fully spelled day-of-week (Sunday, Monday)  +| WWW | Fully spelled day-of-week (Sunday, Monday) ​|  
-M - Non-zero-filled month number (1-January, 2-February)  +| M | Non-zero-filled month number (1-January, 2-February) ​|  
-0M - Zero-filled day-of-month number (01-January,​ 02-February)  +| 0M | Zero-filled day-of-month number (01-January,​ 02-February) ​|  
-MM - Three-character month abbreviation (Jan, Feb)  +| MM | Three-character month abbreviation (Jan, Feb) | 
-MMM - Fully spelled month (January, February)  +| MMM | Fully spelled month (January, February) ​| 
-D - Non-zero-filled day-of-month (1, 2, 3)  +| D | Non-zero-filled day-of-month (1, 2, 3) | 
-0D - Zero-filled day-of-month (01, 02, 03)  +| 0D | Zero-filled day-of-month (01, 02, 03) | 
-J - Non-zero-filled Julian date (1, 2)  +| J | Non-zero-filled Julian date (1, 2) | 
-0J - Zero-filled Julian date (01, 02)  +| 0J | Zero-filled Julian date (01, 02) | 
-YY - Two-digit year (99, 00)  +| YY | Two-digit year (99, 00) | 
-YYYY - Four-digit year (1999, 2000)  +| YYYY | Four-digit year (1999, 2000) |  
-H - 12-hour, non-zero-filled hour of day (12, 1)  +| H | 12-hour, non-zero-filled hour of day (12, 1) | 
-0H - 12-hour, zero-filled hour of day (12, 01)  +| 0H | 12-hour, zero-filled hour of day (12, 01) | 
-HH - 24-hour, non-zero-filled hour of day (24, 1)  +| HH | 24-hour, non-zero-filled hour of day (24, 1) |  
-0HH - 24-hour, zero-filled hour of day (24, 01)  +| 0HH | 24-hour, zero-filled hour of day (24, 01) | 
-N - Non-zero-filled minute of hour (1, 2)  +| N | Non-zero-filled minute of hour (1, 2) | 
-0N - Zero-filled minute of hour (01, 02)  +| 0N | Zero-filled minute of hour (01, 02) | 
-S - Non-zero-filled second of minute (1, 2)  +| S | Non-zero-filled second of minute (1, 2) |  
-0S - Zero-filled second of minute (01, 02)  +| 0S | Zero-filled second of minute (01, 02) | 
-F - Non-zero-filled fraction of a second (1, 2)  +| F | Non-zero-filled fraction of a second (1, 2) |  
-0F - Zero-filled fraction of a second (01, 02)  +| 0F | Zero-filled fraction of a second (01, 02) | 
-A - Lowercase am/pm indicator  +| A | Lowercase am/pm indicator ​| 
-AA - Uppercase AM/PM indicator +| AA | Uppercase AM/PM indicator ​|
-</​code>​+
 == FROM == == FROM ==
 Required. Required.
Line 51: Line 50:
 Required. A date formatted as any valid SQL92 date_class data type. Required. A date formatted as any valid SQL92 date_class data type.
  
-If the original date is an OMNIDEX DATE or OMNIDEX DATETIME column, the return data type is C STRING length 32. Otherwise, the return data type is as follows:+If the original date is an OMNIDEX DATE or OMNIDEX DATETIME column, the return data type is C STRING length 32. 
  
 ===== Example ===== ===== Example =====
 ==== Example 1 ==== ==== Example 1 ====
 +<code SQL>
 +select status,
 +extract(mmm FROM orders.order_date)
 +from orders ​
 +where product_no='​PRN4356'​
 +
 +ORDR   ​JANUARY
 +ORDR   ​DECEMBER
 +CNCL   MARCH
 +</​code>​
 +
 {{page>:​bottom_add&​nofooter&​noeditbtn}} {{page>:​bottom_add&​nofooter&​noeditbtn}}
 
Back to top
dev/sql/functions/extract.1259968257.txt.gz · Last modified: 2012/10/26 14:27 (external edit)