Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: Wednesday, October 14, 2015 5:06 AM
Points: 14, Visits: 27
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-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:48 AM
Points: 40,391, Visits: 37,599
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."

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

Add to briefcase

Permissions Expand / Collapse