Sybase Convert函数
来源:互联网 发布:上帝不会掷骰子 知乎 编辑:程序博客网 时间:2024/06/13 23:17
CONVERT function [Data type conversion]
Returns an expression converted to a supplied data type.
CONVERT( datatype, expression [ , format-style ] )
Parameters
- datatype
The data type to convert the expression into. Set the data type explicitly, or specify the %TYPE attribute to set the data type to the data type of a column in a table or view, or to the data type of a variable.
- expression
The expression to be converted.
- format-style
The style code to apply to the output value. Use this parameter when converting strings to date or time data types, and vice versa. The table below shows the supported style codes, followed by a representation of the output format produced by that style code. The style codes are separated into two columns, depending on whether the century is included in the output format (for example, 06 versus 2006).
Style code 0 is used if an argument is not provided.
Without century (yy) style codes With century (yyyy) style codes Output format -0 or 100Mmm dd yyyy hh:nnAA1101mm/dd/yy[yy]2102[yy]yy.mm.dd3103dd/mm/yy[yy]4104dd.mm.yy[yy]5105dd-mm-yy[yy]6106dd Mmm yy[yy]7107Mmm dd, yy[yy]8108hh:nn:ss-9 or 109Mmm dd yyyy hh:nn:ss:sssAA10110mm-dd-yy[yy]11111[yy]yy/mm/dd12112[yy]yymmdd-13 or 113dd Mmm yyyy hh:nn:ss:sss (24 hour clock, Europe default + milliseconds, 4-digit year )-14 or 114hh:nn:ss:sss (24 hour clock)-20 or 120yyyy-mm-dd hh:nn:ss (24-hour clock, ODBC canonical, 4-digit year)-21 or 121yyyy-mm-dd hh:nn:ss.sss (24 hour clock, ODBC canonical with milliseconds, 4-digit year )
Returns
Depends on the data type specified.
Remarks
The CONVERT function can be used to convert a string to a DATE, TIME, or TIMESTAMP data type, provided that there is no ambiguity when parsing the string. If format-style is specified, then the database server may use it as a hint on how to parse the string. The database server returns an error if it cannot parse the string unambiguously.
UltraLite: This function is similar to the CAST function but allows you to specify a format style to assist with date and time data type conversions.
Standards
- ANSI/ISO SQL Standard
The CONVERT function is defined in the ANSI/ISO SQL Standard. However, in the Standard the purpose of CONVERT is to perform a transcoding of the input string expression to a different character set, which is implemented in the software as the CSCONVERT function.
Example
The following statements illustrate the use of format style:
SELECT CONVERT( CHAR( 20 ), OrderDate, 104 ) FROM GROUPO.SalesOrders;
SELECT CONVERT( CHAR( 20 ), OrderDate, 7 ) FROM GROUPO.SalesOrders;
The following statement illustrates conversion to an integer and returns the value 5:
SELECT CONVERT( integer, 5.2 );
The following statement converts a value to the data type defined for the BirthDate column (DATE data type) of the Employees table:
SELECT CONVERT ( Employees.BirthDate%TYPE, '1966-10-30' );
- sybase convert 函数
- Sybase 的convert函数
- Sybase Convert函数
- Sybase中convert函数中第三个参数的格式
- sybase下convert函数第三个参数(时间格式)
- sybase函数
- Sybase函数
- Sybase函数
- Sybase函数
- Sybase 函数
- Sybase 函数
- Sybase 函数
- CONVERT函数
- convert函数
- CONVERT函数
- Sybase字符串函数
- Sybase日期函数
- sybase 日期函数
- jsonp, 跨域请求
- python函数学习--函数的四种传参方式
- centos7搭建hadoop集群
- 工作一年,突然有新的感悟
- saltstack安装
- Sybase Convert函数
- js实现图片左右轮播(一)
- 实现一个简单的Web服务器
- 写环境变量后 怎么才能立刻生效
- iOS 购物车
- kali虚拟机无法正常上网的解决过程
- Android所有权限以及权限分类
- 【MySQL】使用JDBC时,无法连接远程MySQL数据库
- Keepalived