怎样将数据类型varchar转换成numeric!!
解决方案 »
- 请问VSFLEXGRID如何绑定显示“shape() append() relate... to....”结构的数据分层显示啊?
- 简单问题,怎样去掉窗体,状态栏右下角的那一小块带斜线的区域
- vb6.0调用Excel出错,急,在线等,解决马上结贴
- 一个快捷键的问题!
- 关于Run-time error '429' ActiveX componnent can't create
- 实时错误’-2147217887(80040e21)’:
- VB中什么控件用来编辑报表最好!
- vb中用webBrowser 打印预览时,数据正常显示,但和实际打印顺序不一致
- 哪有installshield6.2 语言包下!
- 用Package & Deployment Wizard打包VB程序,安装时出了问题
- 怎么判断Excel的sheet中是否有Shapes?
- VB中怎样用SAX读取XML文件?
cast 或 convert 函数。
返回包含于字符串内的数字,字符串中是一个适当类型的数值。语法Val(string)必要的 string 参数可以是任何有效的字符串表达式.说明Val 函数,在它不能识别为数字的第一个字符上,停止读入字符串。那些被认为是数值的一部分的符号和字符,例如美圆号与逗号,都不能被识别。但是函数可以识别进位制符号 &O(八进制)和 &H(十六进制)。空白、制表符和换行符都从参数中被去掉。下面的返回值为 1615198:Val(" 1615 198th Street N.E.")在下面的代码中,Val 为所示的十六进制数值返回十进制数值 -1。Val("&HFFFF")注意 Val 函数只会将句点(.)当成一个可用的小数点分隔符。当使用不同的小数点分隔符时,如在国际版应用程序中,代之以 CDbl 来把字符串转换为数字。
SyntaxUsing CAST:
CAST(expression AS data_type)
Using CONVERT:CONVERT (data_type[(length)], expression [, style])ArgumentsexpressionIs any valid Microsoft?SQL Server?expression. For more information, see Expressions. data_typeIs the target system-supplied data type. User-defined data types cannot be used. For more information about available data types, see Data Types. lengthIs an optional parameter of nchar, nvarchar, char, varchar, binary, or varbinary data types. styleIs the style of date format you want when converting datetime or smalldatetime data to character data (nchar, nvarchar, char, varchar, nchar, or nvarchar data types), or the string format when converting float, real, money, or smallmoney data to character data (nchar, nvarchar, char
, varchar, nchar, or nvarchar data types).
In the table, the two columns on the left represent the style values for datetime
or smalldatetime conversion to character data. Add 100 to a style value to get a four-place year that includes the century (yyyy).Without
century
(yy) With
century
(yyyy)