本文介绍了在SQL Server中将Varchar转换为Int Data类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello iam使用sqlserver 2008.

Iam将table1与studentid列作为int。另一个表table12与studentntid列为id.Now我必须将数据从table1移动到table2.Before我需要检查table1中的数据是否为整数。如果它是整数,我需要允许它到table2。



我试过isnumeric(studentid ),它接受浮动也像10.0

我试过转换(studentid,int),抛出错误:无法从varchar转换为int。





感谢您的帮助

Hello iam using sqlserver 2008.
Iam having table1 with studentid column as int.And another table table12 with same studentid column as id.Now i have to move the data from table1 to table2.Before dat i need to check whether the data in table1 is integer or not.If it is integer,i need to allow it to table2.

I have tried isnumeric(studentid),it is accepting float also like 10.0
I tried with convert(studentid,int),throwing error :cannot convert from varchar to int.


Thanks for any help

推荐答案


这篇关于在SQL Server中将Varchar转换为Int Data类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 19:19