Access911.net   |   a9BBS   |   OTaA System  
  搜索文章:  
Access911欢迎您光临  
   主页      上传      繁體版       论坛     
设为首页  |  加入收藏   
  
你现在的位置:文章索引 -> 文章分类 -> 函数  
 首页|  近日更新|  下载  |  文章索引  |  搜索|  术语|  承接工程|  
 
系统正在加载内容,请耐心等待...
 
 查询
 窗体
 报表
 
 
 VBA
 函数
 ADO/DAO/ADO.NET
 API
 ADP
 安全
 发布
 OA
 ASP/ASP.NET
 其他语言
 控件
 DELPHI
 C#/.Net
 本站
 其他
 小例程
 常用软件
 参考文档
 业主作品
 网友大作
 
 
友情链接
 access911.net
 
访问人次
 1702239
 
站长 E-Mail
 net911@sina.com
 access911@gmail.com
 
RSS 订阅

显示附加信息 >>>

ODBC标量函数(1)(英文)——字符串

作者:MS  摘自:Microsoft  :cg1  更新日期:2004-7-13  浏览人次:

 

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcstring_functions.asp

String Functions

The following table lists string manipulation functions. An application can determine which string functions are supported by a driver by calling SQLGetInfo with an information type of SQL_STRING_FUNCTIONS.

Arguments denoted as string_exp can be the name of a column, a character-string-literal, or the result of another scalar function, where the underlying data type can be represented as SQL_CHAR, SQL_VARCHAR, or SQL_LONGVARCHAR.

Arguments denoted as character_exp are a variable-length character string.

Arguments denoted as start, length, or count can be a numeric-literal or the result of another scalar function, where the underlying data type can be represented as SQL_TINYINT, SQL_SMALLINT, or SQL_INTEGER.

The string functions listed here are 1-based; that is, the first character in the string is character 1.

The BIT_LENGTH, CHAR_LENGTH, CHARACTER_LENGTH, OCTET_LENGTH, and POSITION string scalar functions have been added in ODBC 3.0 to align with SQL-92.

Function Description
ASCII(string_exp)
(ODBC 1.0)
Returns the ASCII code value of the leftmost character of string_exp as an integer.
BIT_LENGTH(string_exp)
(ODBC 3.0)
Returns the length in bits of the string expression.
CHAR(code)
(ODBC 1.0)
Returns the character that has the ASCII code value specified by code. The value of code should be between 0 and 255; otherwise, the return value is data source–dependent.
CHAR_LENGTH(string_exp)
(ODBC 3.0)
Returns the length in characters of the string expression, if the string expression is of a character data type; otherwise, returns the length in bytes of the string expression (the smallest integer not less than the number of bits divided by 8). (This function is the same as the CHARACTER_LENGTH function.)
CHARACTER_LENGTH(string_exp)
(ODBC 3.0)
Returns the length in characters of the string expression, if the string expression is of a character data type; otherwise, returns the length in bytes of the string expression (the smallest integer not less than the number of bits divided by 8). (This function is the same as the CHAR_LENGTH function.)
CONCAT(string_exp1, string_exp2)
(ODBC 1.0)
Returns a character string that is the result of concatenating string_exp2 to string_exp1. The resulting string is DBMS-dependent. For example, if the column represented by string_exp1 contained a NULL value, DB2 would return NULL but SQL Server would return the non-NULL string.
DIFFERENCE(string_exp1, string_exp2)
(ODBC 2.0)
Returns an integer value that indicates the difference between the values returned by the SOUNDEX function for string_exp1 and string_exp2.
INSERT(string_exp1, start, length, string_exp2)
(ODBC 1.0)
Returns a character string where length characters have been deleted from string_exp1, beginning at start, and where string_exp2 has been inserted into string_exp, beginning at start.
LCASE(string_exp)
(ODBC 1.0)
Returns a string equal to that in string_exp, with all uppercase characters converted to lowercase.
LEFT(string_exp, count)
(ODBC 1.0)
Returns the leftmost count characters of string_exp.
LENGTH(string_exp)
(ODBC 1.0)
Returns the number of characters in string_exp, excluding trailing blanks.
LOCATE(string_exp1, string_exp2[, start])
(ODBC 1.0)
Returns the starting position of the first occurrence of string_exp1 within string_exp2. The search for the first occurrence of string_exp1 begins with the first character position in string_exp2 unless the optional argument, start, is specified. If start is specified, the search begins with the character position indicated by the value of start. The first character position in string_exp2 is indicated by the value 1. If string_exp1 is not found within string_exp2, the value 0 is returned.

If an application can call the LOCATE scalar function with the string_exp1, string_exp2, and start arguments, the driver returns SQL_FN_STR_LOCATE when SQLGetInfo is called with an Option of SQL_STRING_FUNCTIONS. If the application can call the LOCATE scalar function with only the string_exp1 and string_exp2 arguments, the driver returns SQL_FN_STR_LOCATE_2 when SQLGetInfo is called with an Option of SQL_STRING_FUNCTIONS. Drivers that support calling the LOCATE function with either two or three arguments return both SQL_FN_STR_LOCATE and SQL_FN_STR_LOCATE_2.

LTRIM(string_exp)
(ODBC 1.0)
Returns the characters of string_exp, with leading blanks removed.
OCTET_LENGTH(string_exp)
(ODBC 3.0)
Returns the length in bytes of the string expression. The result is the smallest integer not less than the number of bits divided by 8.
POSITION(character_exp IN character_exp)
(ODBC 3.0)
Returns the position of the first character expression in the second character expression. The result is an exact numeric with an implementation-defined precision and a scale of 0.
REPEAT(string_exp, count)
(ODBC 1.0)
Returns a character string composed of string_exp repeated count times.
REPLACE(string_exp1, string_exp2, string_exp3)
(ODBC 1.0)
Search string_exp1 for occurrences of string_exp2, and replace with string_exp3.
RIGHT(string_exp, count)
(ODBC 1.0)
Returns the rightmost count characters of string_exp.
RTRIM(string_exp)
(ODBC 1.0)
Returns the characters of string_exp with trailing blanks removed.
SOUNDEX(string_exp)
(ODBC 2.0)
Returns a data source–dependent character string representing the sound of the words in string_exp. For example, SQL Server returns a 4-digit SOUNDEX code; Oracle returns a phonetic representation of each word.
SPACE(count) (ODBC 2.0) Returns a character string consisting of count spaces.
SUBSTRING(string_exp, start, length)
(ODBC 1.0)
Returns a character string that is derived from string_exp, beginning at the character position specified by start for length characters.
UCASE(string_exp)
(ODBC 1.0)
Returns a string equal to that in string_exp, with all lowercase characters converted to uppercase.

 

 
相关文章
     没有手动相关文章
     ODBC标量函数(6)(英文)——SQL 92 CAST 函数
     ODBC标量函数(5)(英文)——数据类型转换函数
     ODBC标量函数(4)(英文)——系统函数
     ODBC标量函数(3)(英文)——日期时间函数
     ODBC标量函数(2)(英文)——数值函数
 
评论
     查看或发表更多的评论,请单击这里。
 
 
 
 
 
   
  Access911.net   |   a9BBS   |   OTaA System   |
建站日期:2000年4月2日  |  设计施工:陈格 ( access911 & cg1 )
 Copyright © 2000 - 2003 COMET, 陈格 保留所有权利