This is a mirror of official site: http://jasper-net.blogspot.com/

T-SQL Israeli CardID Checker / ת.ז. ישראלית

| Tuesday, August 24, 2010
Once in a while I come across code that I didn’t fins in the internet … mainly because it’s for local use ;)
This is one of these times :)

This code is the T-SQL version of the algorithm  that checks the given Israeli CardID , and adds a leading Zero , if need one ( like in my personal case ) , and calculates the “Check Number” ( SIFRAT BIKORET ) , if it’s missing.

I needed this for an SSIS Package that loaded monthly information needed for my SharePoint Content ;)

BTW , there might be a better way to code this , but i’m no T-SQL expert :)

  • ALTER FUNCTION [dbo].[fn_FixUpCardID]   
  •     (   
  •     @CardID VARCHAR(50)   
  •     )   
  • RETURNS VARCHAR(50)   
  • AS   
  •     BEGIN   
  •     DECLARE @CardID_1 INT   
  •     DECLARE @CardID_2 INT      
  •     DECLARE @CardID_3 INT   
  •     DECLARE @CardID_4 INT   
  •     DECLARE @CardID_5 INT   
  •     DECLARE @CardID_6 INT   
  •     DECLARE @CardID_7 INT   
  •     DECLARE @CardID_8 INT   
  •     DECLARE @CardID_9 INT   
  •     DECLARE @CardID_1_CalcVal INT   
  •     DECLARE @CardID_2_CalcVal INT      
  •     DECLARE @CardID_3_CalcVal INT   
  •     DECLARE @CardID_4_CalcVal INT   
  • Posted via email from .NET Info

    0 comments: