获得出生日期:
convert(smalldatetime,substring(PersonalInfo.userIDNumber,7,8)) as newBirthday,
获得年龄
datediff(year,convert(smalldatetime,substring(PersonalInfo.userIDNumber,7,8)),getdate()) as newAge,
其中:PersonalInfo.userIDNumber表示为身份证号列
获得出生日期:
convert(smalldatetime,substring(PersonalInfo.userIDNumber,7,8)) as newBirthday,
获得年龄
datediff(year,convert(smalldatetime,substring(PersonalInfo.userIDNumber,7,8)),getdate()) as newAge,
其中:PersonalInfo.userIDNumber表示为身份证号列
转载于:https://www.cnblogs.com/feilong3540717/archive/2011/11/14/2249081.html