googoling...
how tow use this query, is not readable for me!:-)
iif(IIf(Mid([CodFiscale];10;2)>40;Mid([CodFiscale];10;2)-40;Mid([CodFiscale];10;2))<10;"0"& IIf(Mid([CodFiscale];10;2)>40;Mid([CodFiscale];10;2)-40;CInt(Mid([CodFiscale];10;2)));IIf(Mid([CodFiscale];10;2)>40;Mid([CodFiscale];10;2)-40;Mid([CodFiscale];10;2))) & "/" & Switch(Mid([CodFiscale];9;1)="A";"01";Mid([CodFiscale];9;1)="B";"02";Mid([CodFiscale];9;1)="C";"03";Mid([CodFiscale];9;1)="D";"04";Mid([CodFiscale];9;1)="E";"05";Mid([CodFiscale];9;1)="H";"06";Mid([CodFiscale];9;1)="L";"07";Mid([CodFiscale];9;1)="M";"08";Mid([CodFiscale];9;1)="P";"09";Mid([CodFiscale];9;1)="R";"10";Mid([CodFiscale];9;1)="S";"11";Mid([CodFiscale];9;1)="T";"12") & IIf(Mid([CodFiscale];7;2)<15;"20";"19") & "/" & Mid([CodFiscale];7;2)
in effect i need to update the field DATANASC, in this format DD/MM/YYYY, where CodFiscale, not is null
note:
with ADO and vb6, please
EXTRACT DATE FROM codice fiscale
-
- Administrator
- Posts: 78412
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: EXTRACT DATE FROM codice fiscale
And you expect us to understand it without even the slightest indication of what CodFiscale contains?
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4351
- Joined: 26 Apr 2010, 17:36
-
- Administrator
- Posts: 78412
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: EXTRACT DATE FROM codice fiscale
Try
Format(DateSerial(Mid(s,7,2)+IIf(Mid(s,7,2)<15,2000,1900),InStr("ABCDEHLMPRST",Mid(s,9,1)),Mid(s,10,2)Mod40),"dd/mm/yyyy")
Format(DateSerial(Mid(s,7,2)+IIf(Mid(s,7,2)<15,2000,1900),InStr("ABCDEHLMPRST",Mid(s,9,1)),Mid(s,10,2)Mod40),"dd/mm/yyyy")
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78412
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- PlatinumLounger
- Posts: 4351
- Joined: 26 Apr 2010, 17:36
Re: EXTRACT DATE FROM codice fiscale
Ok but i need a SQL, to update the field DATANASC, Is the birthday date, in table...
With codice fiscale not Is null, and DATANASC Is null...
-
- Administrator
- Posts: 78412
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: EXTRACT DATE FROM codice fiscale
I really have to spell it out for you...
SQL = "UPDATE Tabella SET DATANASC = Format(DateSerial(Mid(CodFiscale,7,2)+IIf(Mid(CodFiscale,7,2)<15,2000,1900),InStr('ABCDEHLMPRST',Mid(CodFiscale,9,1)),Mid(CodFiscale,10,2) Mod 40),'dd/mm/yyyy') WHERE DATANASC Is Null AND CodFiscale Is Not Null"
SQL = "UPDATE Tabella SET DATANASC = Format(DateSerial(Mid(CodFiscale,7,2)+IIf(Mid(CodFiscale,7,2)<15,2000,1900),InStr('ABCDEHLMPRST',Mid(CodFiscale,9,1)),Mid(CodFiscale,10,2) Mod 40),'dd/mm/yyyy') WHERE DATANASC Is Null AND CodFiscale Is Not Null"
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4351
- Joined: 26 Apr 2010, 17:36
Re: EXTRACT DATE FROM codice fiscale
Tks bro, but i cannot test now...HansV wrote: ↑27 Jan 2022, 21:47I really have to spell it out for you...
SQL = "UPDATE Tabella SET DATANASC = Format(DateSerial(Mid(CodFiscale,7,2)+IIf(Mid(CodFiscale,7,2)<15,2000,1900),InStr('ABCDEHLMPRST',Mid(CodFiscale,9,1)),Mid(CodFiscale,10,2) Mod 40),'dd/mm/yyyy') WHERE DATANASC Is Null AND CodFiscale Is Not Null"
But Sure work.