rodne cislo
Ad ranni dotaz na rodne cislo, ktery uz byl mezitim smazan. Prave dnes jsem byl nucen resit ten samy problem.
Udelal jsem to takhle:
SELECT * FROM tabulka
WHERE
((MID(REPLACE(rodnecislo,"/",""),1,2)+MID(REPLACE(rodnecislo,"/",""),3,2)+MID(REPLACE(rodnecislo,"/",""),5,2)+MID(REPLACE(rodnecislo,"/",""),7,2)+MID(REPLACE(rodnecislo,"/",""),9))/11)
<>
FLOOR((MID(REPLACE(rodnecislo,"/",""),1,2)+MID(REPLACE(rodnecislo,"/",""),3,2)+MID(REPLACE(rodnecislo,"/",""),5,2)+MID(REPLACE(rodnecislo,"/",""),7,2)+MID(REPLACE(rodnecislo,"/",""),9))/11)
...kde rodnecislo je retezec ve tvaru 123456/1234, nebo i bez lomitka. Vzorecek vyhodnoti jako chybna i rodna cisla s tremi ciframi za lomitkem. Na ty se asi zadny vzorecek uplatnit neda.
Slo by to resit nejak elegantneji? |