int in string的问题 string strempid2="1000,10001,10002,10003"string sql="select email from employee where emp_id in (" & strempid2 & " ) "emp_id 是int类型strempid2是string,执行SQL时 会提示类型转换为int错误 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 sql输出是什么?select email from employee where emp_id in (1000,10001,10002,10003)的话应该不会错 string strempid2="1000,10001,10002,10003"string sql="select email from employee where rtrim(emp_id) in (" & strempid2 & " ) " string strempid2="1000,10001,10002,10003"string sql="select email from employee where cast(emp_id as varchar) in (" & strempid2 & " ) " 將 varchar 值 '11800z01' 轉換成資料類型 int 時,轉換失敗。string strempid2="1000,10001,10002,10003"string sql="select email from employee where emp_id in (" & strempid2 & " ) "emp_id里有 11800z01之类的id但我的语句并没有将什么转为int啊 楼上的,那是因为emp_id 是int 型,而后面的不是INT型。所以提示 string strempid2="1000,10001,10002,10003"string sql="select email from employee where CHARINDEX(','+CONVERT(VARCHAR,emp_id)+',',','+strempid2 +','>0 看错了。抱歉。因为楼主后面传入的参数是INT ,而emp_ID型不是INT,所以报错。 这样写应该可以了.string strempid2="1000,10001,10002,10003";strempid2 = "'" + strempid2.Replace(",","','" ) + ",";string sql="select email from employee where emp_id in ( " & strempid2 & " ) " 求教查询动态列的数据集返回问题 能不能查看sql语句的执行过程? 救命!!!第一次安装SQL2005开发版,为什么没有Management Studio? 如何建立复合聚集索引? 求一条sql查询语句,项目用,急! 求大大们解惑 SQL语句转化 一个递归触发器的问题,请进,帮我解决一下,谢谢~ 为什么我的企业管理器连不上远程sql server数据库?查询分析器却可以 字符串处理问题 怎么求:两个日期之间相差几年? 求分类汇总sql语句? 两表的关系,是另建一个关系表好,还是在原表字段进行关系好?例如
select email from employee where emp_id in (1000,10001,10002,10003)的话应该不会错
string sql="select email from employee where rtrim(emp_id) in (" & strempid2 & " ) "
string sql="select email from employee where cast(emp_id as varchar) in (" & strempid2 & " ) "
將 varchar 值 '11800z01' 轉換成資料類型 int 時,轉換失敗。string strempid2="1000,10001,10002,10003"
string sql="select email from employee where emp_id in (" & strempid2 & " ) "emp_id里有 11800z01之类的id
但我的语句并没有将什么转为int啊
所以提示
string strempid2="1000,10001,10002,10003"
string sql="select email from employee
where CHARINDEX(','+CONVERT(VARCHAR,emp_id)+',',','+strempid2 +','>0
因为楼主后面传入的参数是INT ,而emp_ID型不是INT,所以报错。
这样写应该可以了.
string strempid2="1000,10001,10002,10003";
strempid2 = "'" + strempid2.Replace(",","','" ) + ",";
string sql="select email from employee where emp_id in ( " & strempid2 & " ) "