-- Testing. The following tests all pass.
;WITH ISIN_Tests AS
( SELECT 'US0378331005' AS ISIN, 1 Expected
  UNION SELECT 'US0373831005',0
  UNION SELECT 'U50378331005',0
  UNION SELECT 'US03378331005',0
  UNION SELECT 'AU0000XVGZA3',1
  UNION SELECT 'AU0000VXGZA3',1
  UNION SELECT 'FR0000988040',1
  UNION SELECT '0___garbage',0
  UNION SELECT '',0
)
SELECT ISIN, Expected, dbo._ISINCheck(ISIN) AS TestResult FROM ISIN_Tests ORDER BY ISIN
