Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:sql:functions:cast [2010/07/04 02:19]
tdo
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 column name that is to be cast. +
  
-== AS == +== expression ​== 
-Required+ 
 +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.
  
 == datatype == == datatype ==
-Required. ​The supported SQL92 data type.+Required. ​ One of the datatypes listed below:
  
-== n == +{{page>​dev:​appendix:​reference:​datatypes_insert&​noheader&​nofooter&​noeditbtn}}
-Length if applicable.+
  
-===== Examples ​===== +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. 
-==== Example 1 ==== + 
-<​code ​SQL+{{page>​dev:​appendix:​reference:​natl_datatypes_insert&​noheader&​nofooter&​noeditbtn}} 
-select ​amount,  + 
-   cast(orders.amount ​as DOUBLE PRECISION) +===== Example ​===== 
-   from orders where status='​cncl'​+==== Example 1: CAST of column ​==== 
-</​code>​ + 
-==== Example 2 ==== +<​code>​ 
-<code SQL> +select cast(individual ​as integerind from individuals
-select order_date, + 
-   cast(substring(order_date from 1 for 2) as INTEGER) +IND 
-   from orders ​ +----------- 
-   where status='​back';​+  ​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.1278209957.txt.gz · Last modified: 2016/06/28 22:38 (external edit)