Differences

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

Link to this comparison view

Next revision
Previous revision
dev:sql:functions:cast [2009/12/04 22:35]
tdo created
dev:sql:functions:cast [2016/06/28 22:38] (current)
Line 1: Line 1:
 {{page>:​top_add&​nofooter&​noeditbtn}} {{page>:​top_add&​nofooter&​noeditbtn}}
-<​html><​div align="​center"><​span style="​color:​red">​DRAFT</​span></​div></​html>​ 
-====== Omnidex SQL Function: CASE ====== 
 {{page>:​sql_bar&​nofooter&​noeditbtn}} {{page>:​sql_bar&​nofooter&​noeditbtn}}
 +====== Omnidex SQL Function: CAST ======
 ===== Description ===== ===== Description =====
-The CAST function converts ​expressions ​to a specified data type. Column formatting will be the default for the specified data type.+The CAST function converts ​an expression ​to the requested datatype.
  
-Due to conflicts ​in specifications, ​the main OmniAccess data types are not supported here. The $CONVERT ​function ​should be used for OmniAccess data types and for more specific functions.+This function returns the datatype requested ​in the function.
 ===== Syntax ===== ===== Syntax =====
-  CAST(scalar_expression AS datatype[(n)]) 
  
-== scalar_expression == +  CAST(expression AS datatype)
-Required. The item that is to be cast. Column name.+
  
-== AS == +== expression ​==
-Required+
  
-==== datatype ==== +Required. ​An expression using SQL language that produces a value. A scalar expression is generally equivalent to a select item in the SQL SELECT statement, and can be a character expression, numeric expression or date expression.
-Required. ​The supported SQL92 data type.+
  
-== == +== datatype ​== 
-Length if applicable.+Required One of the datatypes listed below:
  
-===== Examples ​===== +{{page>​dev:​appendix:​reference:​datatypes_insert&​noheader&​nofooter&​noeditbtn}} 
-==== Example 1 ==== + 
-<​code ​SQL+Omnidex also provides partial support for National Character Datatypes (sometimes called Unicode datatypes or wide characters). The Omnidex SQL Engine will process these datatypes, but the Omnidex Indexing Engine will only index the lower 8 bits of these datatypes. 
-select ​amount,  + 
-cast(orders.amount ​as DOUBLE PRECISION) +{{page>​dev:​appendix:​reference:​natl_datatypes_insert&​noheader&​nofooter&​noeditbtn}} 
-from orders where status='​cncl'​ + 
-</​code>​ +===== Example ​===== 
-==== Example 2 ==== +==== Example 1: CAST of column ​==== 
-<code SQL> + 
-select order_date, +<​code>​ 
-cast(substring(order_date from 1 for 2) as INTEGER) +select cast(individual ​as integerind from individuals;​ 
-from orders ​ + 
-where status='​back'​+IND 
 +----------- 
 +  ​900011022 
 +  ​900047761 
 +  ​900047762 
 +  ​900067115 
 +  900067114 
 +  900215567 
 +  900240828
 </​code>​ </​code>​
  
 +
 +====== Additional Resources ======
 +
 +See also:
 +{{page>​dev:​sql:​functions:​see_also_utility&​noheader&​nofooter&​noeditbtn}}
  
  
 {{page>:​bottom_add&​nofooter&​noeditbtn}} {{page>:​bottom_add&​nofooter&​noeditbtn}}
 
Back to top
dev/sql/functions/cast.1259966122.txt.gz · Last modified: 2016/06/28 22:38 (external edit)