当前位置:网站首页>sqlserver 字符串类型转换成小数或者整数类型
sqlserver 字符串类型转换成小数或者整数类型
2022-06-30 20:37:00 【※※冰馨※※】
在SQL Server中,将字符串的值转换为数值类型的值可以有三种方法。
1.使用cast()方法。
select cast('6.0' as decimal(6, 2)); -- 6.00
2.使用convert()方法。
select convert(decimal(6, 2), '100'); -- 100.00
3.使用与数值0相加的方法。
select '233' + 0; -- 233
以上三种方法在转换类型的时候都要格外注意被转换类型的值,因为可能会出现各种强制转换失败的问题,比如小数位数/格式不匹配造成的报错。
边栏推荐
- 浅谈代码语言的魅力
- docker安装mysql
- Playwright - scroll bar operation
- PM reports work like this, and the boss is willing to give you a raise
- jfinal中如何使用过滤器监控Druid监听SQL执行?
- PHP obtains opcode and C source code
- MFC界面库BCGControlBar v33.0 - 桌面警报窗口、网格控件升级等
- PHP获取Opcode及C源码
- 报错FileSystemException: /datas/nodes/0/indices/gtTXk-hnTgKhAcm-8n60Jw/1/index/.es_temp_file:结构需要清理
- Is it safe to open an account for online stock trading!?
猜你喜欢
A complete collection of vulnerability scanning tools. Mom doesn't have to worry that I won't find any more vulnerabilities
Lumiprobe dye hydrazide - BDP FL hydrazide solution
The newly born robot dog can walk by himself after rolling for an hour. The latest achievement of Wu Enda's first disciple
maya房子建模
Halcon knowledge: check the measurement objects [1]
Lumiprobe蛋白质定量丨QuDye 蛋白定量试剂盒
Lumiprobe染料酰肼丨BDP FL 酰肼方案
注册设备监理师难考吗,和监理工程师有什么关系?
AVL平衡二叉树(一) - 概念与C语言实现
Lumiprobe cell biology - dia, instructions for lipophilic tracer
随机推荐
关于,奇安信检测代码漏洞,XSS系列解决
Scene 299
Lumiprobe细胞生物学丨DiA,亲脂性示踪剂说明书
centos——开启/关闭oracle
Lumiprobe无铜点击化学解决方案
Testing principle and precautions of biovendor rage ELISA Kit
Description of the latest RTSP address rules for Hikvision camera, NVR, streaming media server, playback and streaming [easy to understand]
Lumiprobe cell biology - dia, instructions for lipophilic tracer
CentOS - enable / disable Oracle
B_QuRT_User_Guide(33)
北京大学ACM Problems 1006:Biorhythms
[原创]用代码dialog 高度 宽度无法屏幕屏幕问题
Peking University ACM problems 1004:financial management
1.微信小程序页面跳转方法总结;2. navigateTo堆栈到十层不跳转问题
Go language identifier and package name specification
Study on lumiprobe dye NHS ester BDP FL NHS ester
MFC界面库BCGControlBar v33.0 - 桌面警报窗口、网格控件升级等
uniapp怎么上传二进制图片
开发技术-使用easyexcel导入文件(简单示例)
北京大学ACM Problems 1002:487-3279