`
hanbaohong
  • 浏览: 388254 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

从身份证号提取生日并更新到生日字段中的SQL语句

 
阅读更多
update 学生信息 set 生日=substring(身份证号,7,4)+'-'+substring(身份证号,11,2)+'-'+substring(身份证号,13,2)
where LEN(身份证号)=18

 

update 学生信息 set 性别='男'
where LEN(身份证号)=18 and substring(身份证号,17,1)%2=1
update 学生信息 set 性别='女'
where LEN(身份证号)=18 and substring(身份证号,17,1)%2=0

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics