Validating identy


04-Aug-2020 00:45

Regards, Willem Hi Guys, I tried to find a SQL Implementation of this function but Google failed me but I still know one exists. Let me know what you think:-- =============================================-- Author: Craig Peacock-- Create date: 08/10/2007-- Description: This will validate a SA ID Number-- =============================================ALTER PROCEDURE [dbo].[VAL_S01_Validate SAIDNumber] @IDNumber VARCHAR (13)ASBEGIN /* This function was created from the function posted at: DECLARE @A INT -- ~Holds Negative Index numbers DECLARE @B INT -- ~Holds Positive Index numbers DECLARE @C INT DECLARE @D INT -- ~The check digit DECLARE @I INT -- ~Counter Variable SET @D = -1 SET @A = 0 SET @B = 0 BEGIN TRY PRINT 'Getting Negative Numbers____________________' SET @I = 0 WHILE (@I 0) BEGIN SET @C = @C @B % 10 SET @B = @B / 10 END --WHILE SET @C = @C @A SET @D = 10 - (@C % 10) IF (@D = 10) SET @D = 0 IF (CAST(SUBSTRING(@IDNumber, 13, 1) AS INT) = @D) RETURN 1 ELSE RETURN 0 END TRY BEGIN CATCH RETURN 0 END CATCH RETURN 0END Willem and Craig, I tried the SQL previously on the blog and it worked (old and new numbers).

Craig's one doesn't seem to work though (unless it is a SQL version problem). It would appear that the tried and trusted rules don't work for ID numbers of people born after 1/1/2000.

A great mathematical mind an Business man will sorely be missed. I assume that if there are SA citizens with an ID from the year 1900, that this would use the same year number: '00'. However, I am not sure if you can distinguish a '1900' ID from a '2000' ID etc.

NET webservice to validate South African Person ID numbers.

It provides validation of a person ID by calculating the check-digit (digit-13), and extracts the date-of-birth, gender, citizenship, sequence and other information.

Regards Jan['validate-id', 'You have entered an invalid identity number', function (v) ] Hi, please can someone help with out with this problem: The second last digit in my driver's licence is DIFFERENT to that in my green ID book. Here's my code: CREATE OR REPLACE FUNCTION CS_VALID_SA_ID_NUMBER ( p_id_number IN VARCHAR2 ) RETURN BOOLEANAS lv_A NUMBER := 0; -- ~Holds Negative Index numbers lv_B NUMBER := 0; -- ~Holds Positive Index numbers lv_C NUMBER; lv_D NUMBER := -1; -- ~The check digit lv_I NUMBER; -- ~Counter Variable lv_is_valid NUMBER; lv_the_number NUMBER; lv_rply BOOLEAN := FALSE; BEGIN--Getting Negative Numbers lv_I := 0 ; IF (lv_I 0) THEN lv_C := lv_C lv_B mod 10; lv_B := lv_B / 10; END IF;lv_C := lv_C lv_A;lv_D := 10 - (lv_C mod 10); IF (lv_D = 10) THEN lv_D := 0; END IF;lv_the_number := CAST(SUBSTR(p_id_number, 13, 1) AS NUMBER); IF lv_the_number = lv_D THEN lv_is_valid := 1; lv_rply := TRUE; END IF; RETURN lv_rply; -- ************************************ -- ** Handle an unexpected exception ** -- ************************************ EXCEPTION /* When this function throws an exception outside its exception block via the exception procedure will it catch its own exception.

For example, the last three digits in my driver's licence is 050 --- but in my ID it is 084This causes endless confusion. Id # to the picture and name of the person on it so I know if the person I am dealing with is legitimate or just using an valid ID # with his picture on it . I'm trying to convert Craig Peacocks SQL version to PL/SQL function and not getting anywhere. To avaoid this the following statement is required.would be interesting to see how they enforce that.... An old ex Zimbo friend of mine is a permanant resident but long time ago lost his ID book. NET post to cater for erroneous id No's like 0000000024588Its not very ellegant and wont get us into the next century, but then again neither will VB. Public Function parse Id No(By Val id No As String) As Boolean Try Dim a As Integer = 0 For i As Integer = 0 To 5 a = CInt(id No.