如何将Varchar转换为Tinyint [英] How To Convert Varchar TO Tinyint

查看:465
本文介绍了如何将Varchar转换为Tinyint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里我的问题是,当我尝试执行此查询显示错误时如何将varchar转换为tinyint!







<预郎= C#>插入<跨度类= 代码sdkkeyword>到 ShiftGroupInfo(ShiftGroupCodeC,ShiftCodeC,RestDayN,AShiftCodeC)值(<跨度类=代码串>' SAM'' GEN '' Sat,Sun' ' ASGSEC'







错误!

转换失败 转换 varchar '  Sat,Sun'  to  data 类型  tinyint 





如何解决这个问题,...

解决方案

某些字符串值无法转换为数字(tinyint)!

喜欢字符串'Sat '字符串'123'时没有数字表示,并转换为纯数字值123!

SQL中用于转换的命令是CAST或 CONVERT [ ^ ]但是对于你想要的转换类型也会给你错误!!!


Here my prob is, how to convert varchar to tinyint when i try to execute this query showing error !



insert into ShiftGroupInfo(ShiftGroupCodeC,ShiftCodeC,RestDayN,AShiftCodeC) values('SAM','GEN','Sat,Sun','ASGSEC')




Error!

Conversion failed when converting the varchar value 'Sat,Sun' to data type tinyint.



How to solve this,...

解决方案

There are certain string values that can not be converted to numeric (tinyint)!
Like the string 'Sat' has no numeric representation while the string '123' and be converted to the pure-numeric value of 123!
The commands in SQL for converting is CAST or CONVERT[^] but for the type of converting you wish for these also will give you error!!!


这篇关于如何将Varchar转换为Tinyint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆