SQL statement to extract birthday from ID number and update to birthday field

update student information set birthday=substring(ID number,7,4)+'-'+substring(ID card number,11,2)+'-'+substring(ID card number,13,2)
where LEN(ID number)=18

 

update student information set gender='male'
where LEN(ID number)=18 and substring(ID card number,17,1)%2=1
update student information set gender='female'
where LEN(ID number)=18 and substring(ID card number,17,1)%2=0

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326979774&siteId=291194637