Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Formatting date of birth using South African ID number Expand / Collapse
Author
Message
Posted Monday, November 12, 2012 5:49 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, May 24, 2016 7:42 AM
Points: 133, Visits: 1,969
lol too many
I think the OP should maybe shed some more light to get rid of these assumptions
Using the DOB to verify the century is an option


MCITP: Database Administrator 2005
MCTS DBA 2008
Post #1383644
Posted Friday, October 9, 2015 2:37 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, March 15, 2016 12:57 AM
Points: 1, Visits: 35
substring is working well


select
,left([IDNumber],2) as year
,SUBSTRING(Idnumber,3,2) as Month
,SUBSTRING (Idnumber,5,2) as day
,SUBSTRING(Idnumber ,7,4) as gender
,substring (idnumber ,10,3) nationality
from table


kind regards

Michael Gasa
Post #1726772
Posted Friday, October 9, 2015 5:09 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 1:55 AM
Points: 1,142, Visits: 3,407
cyagasa (10/9/2015)
substring is working well


select
,left([IDNumber],2) as year
,SUBSTRING(Idnumber,3,2) as Month
,SUBSTRING (Idnumber,5,2) as day
,SUBSTRING(Idnumber ,7,4) as gender
,substring (idnumber ,10,3) nationality
from table


kind regards

Michael Gasa

Substring works but can't guarantee the correct date.

ID Number: 1410095511000

Birth Date 2014/10/09
-- OR --
Birth Date 1914/10/09





The SQL Guy @ blogspot

@SeanPearceSQL

About Me
Post #1726802
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse