Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 How to Calculate Bank Routing Check Digit Rate Topic Display Mode Topic Options
Author
 Message
 Posted Saturday, September 29, 2007 10:38 PM
 Grasshopper Group: General Forum Members Last Login: Wednesday, November 30, 2011 9:29 AM Points: 14, Visits: 21
 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 Group: General Forum Members Last Login: Today @ 5:35 PM Points: 34,539, Visits: 28,705
 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." "Change is inevitable. Change for the better is not." -- 04 August 2013(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013Helpful Links:How to post code problemsHow to post performance problems
Post #484033

 Permissions