SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Parsing INTERNAL REPRESENTATION OF OVERPUNCH SIGNS

By Bernabe Diaz,

"The Invoice Report and Confirmation of Payment Report contain monetary fields
formatted with over-punch characters, or Extended Binary Coded Decimal
Interchange Code (EBCDIC)."

"00000000035A (In the example to the left the A converts to the number one (1) making the number 351.

Because this is a monetary field and the decimal is implied the true monetary value is $3.51.

The number is considered positive because the letter A falls under the “Signed Positive” column (see chart below). "

--     INTERNAL REPRESENTATION OF OVERPUNCH SIGNS         

--            POSITIVE           A B C D E  F  G H I   {           

--            Numeric value     1  2  3  4  5  6  7  8  9  0      

--            NEGATIVE         J  K L  M  N O P Q R }   

SELECT  CAST([dbo].[udf_OverPunchConversion]('00000000035A') AS MONEY)

Result: 3.51

SELECT  CAST([dbo].[udf_OverPunchConversion]('00000000000{') AS MONEY)

Result: 0.00

Enjoy!

Total article views: 124 | Views in the last 30 days: 11
 
Related Articles
FORUM

SQL-Server 2005: Change Ordinal Column Position

SQL-Server 2005: Change Ordinal Column Position

FORUM

random Number

Unique Number

FORUM

Backup Set Position Number...

I have several backup sets contained in one file (the result of running same backup statement severa...

FORUM

RANDOM positive integer number

Is there anyone knows how to create a function which returns a random positive integer number within...

FORUM

Fill up position numbers

Hello, I have imported article data from a text file: Pos item ------...

Tags
parsing    
 
Contribute