悉野小楼

导航

在数据库中根据身份证号算出生日期

update Staff_information set
csny = 
case when LEN(sfzh)=18 then  (substring(sfzh,7,4) +'-'+  substring(sfzh,11,2)+'-'+ substring(sfzh,13,2)) 
 when LEN(sfzh)=15 then ('19' + substring(sfzh,7,2) +'-'+  substring(sfzh,9,2)+'-'+ substring(sfzh,11,2))
 else null
end
 from Staff_information

posted on 2011-04-20 15:42  悉野  阅读(768)  评论(0编辑  收藏  举报