0
点赞
收藏
分享

微信扫一扫

数据库截取字段的前几位

古得曼_63b6 2022-06-20 阅读 122

截取字段前十位字符串

update dzgw set created_date = SUBSTRING(created_date,0,11)

模板

select id,substring(字段,charindex(',',字段)+1,len(字段)-charindex(',',字段)) from test;

charindex(',',字段))函数用于检索字段内容   参数一是检索的index,参二是字段

substring('参一','参二','参三')  参一是字段名称,参二是开始截取索引,参三是结束截取索引

示例:

select created_date,SUBSTRING(created_date,0,11) from dzgw

 


举报

相关推荐

0 条评论