update [表名] set [性别]=(case when (left(right([身份证],2),1) % 2 = 0) then '女' else '男' end ) where len([身份证])=18 and left(right([身份证],2),1)<>'X'
update [表名] set [性别]=(case when (right([身份证],1) % 2 = 0) then '女' else '男' end ) where len([身份证])=15 and right([身份证],1)<>'X'
update [表名] set [出生日期]=(right(left([身份证],10),4)+'-'+right(left([身份证],12),2)+'-'+right(left([身份证],14),2)) where len([身份证])=18
update [表名] set [出生日期]=('19'+right(left([身份证],8),2)+'-'+right(left([身份证],10),2)+'-'+right(left([身份证],12),2)) where len([身份证])=15
update [表名] set [年龄]=year(getdate())-(cast(left([出生日期],4) as int)) where [出生日期]<>''
相关新闻
- 小程序登录流程图理解 2020-08-18
- 在C#中获取web.config中的配置信息 2021-08-23
- 小程序open-data头像样式 2021-04-10
- 小程序rich-text 富文本解析图片过大和图片路径的问题 2020-11-25
- C#中去掉字符串的最后一个字符 2020-11-23