在选择语句中将字符串转换为整数 [英] Convert string to integer in select statement
本文介绍了在选择语句中将字符串转换为整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
查询以在选择语句itselef中将字符串字段值(具有数字值)转换为整数/长整数
query to convert string field value(having numeric values) to integer/long in select statement itselef
推荐答案
您可以将CAST或CONVERT用作:
You could use CAST or CONVERT as:
CAST(MyVarcharCol AS INT)
CONVERT(INT, MyVarcharCol)
在如下所示的sql语句中使用强制转换功能
选择cast(strValue作为int)
use cast function in sql statement like below
select cast(strValue as int)
使用Cast或Convert功能-请参见^ ].
Use the Cast or Convert funtions - see here[^].
这篇关于在选择语句中将字符串转换为整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文