通过身份证号获得出生日期和年龄 SQL

获得出生日期:

convert(smalldatetime,substring(PersonalInfo.userIDNumber,7,8)) as newBirthday,

获得年龄

datediff(year,convert(smalldatetime,substring(PersonalInfo.userIDNumber,7,8)),getdate()) as newAge,

其中:PersonalInfo.userIDNumber表示为身份证号列

posted @ 2011-11-14 23:47  @龙飞凤舞@  阅读(7272)  评论(0编辑  收藏  举报