Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to Calculate Bank Routing Check Digit Expand / Collapse
Author
Message
Posted Saturday, September 29, 2007 10:38 PM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, April 10, 2014 9:33 AM
Points: 14, Visits: 22
Comments posted to this topic are about the item How to Calculate Bank Routing Check Digit


Got SQL Server? Manage It with Siccolo
Post #404594
Posted Friday, April 11, 2008 11:04 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 11:28 PM
Points: 35,263, Visits: 31,750
You can shrink this down quite a bit...
 CREATE FUNCTION CreateABACheckDigit
--===== Created by Jeff Moden
        
(@RoutingNumber CHAR(8))
RETURNS INT
     AS
  BEGIN
 RETURN
(SELECT NULLIF(10-( SUBSTRING(@RoutingNumber,1,1)*3
                          
+ SUBSTRING(@RoutingNumber,2,1)*7
                          
+ SUBSTRING(@RoutingNumber,3,1)*1
                          
+ SUBSTRING(@RoutingNumber,4,1)*3
                          
+ SUBSTRING(@RoutingNumber,5,1)*7
                          
+ SUBSTRING(@RoutingNumber,6,1)*1
                          
+ SUBSTRING(@RoutingNumber,7,1)*3
                          
+ SUBSTRING(@RoutingNumber,8,1)*7)%10
                      
,10))
    
END




--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #484033
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse