SQL中怎么取出字符串中某两个字符,并转换为数字

来源:百度知道 编辑:UC知道 时间:2024/09/25 05:23:25
从A表的X列中取出第3、4字符,并转换为数字

第三个字符
select convert(int,substring(x,3,1)) from A
第四个字符
select convert(int,substring(x,4,1)) from A
都取
select convert(int,substring(x,3,2)) from A

不知是什么库,下面是sqlserver语法

select convert(int,substring(X,3,2))
from A

string s=select X from A;
String Answer=s.substring(3,5);
int a=int.Parse(s);