# Thread: Using Numeric Data Types

1. Registered User
Join Date
Nov 2006
Posts
13

## Unanswered: Using Numeric Data Types

Hi All,

I'm using ASE 12.0 and i've a query regarding columns with numeric data type.

How the length is calculated from the precision and scale supplied while creating the table. eg: Numeric(12,3). How the length for the column is calculated.

Any help will be appreciated.

Thanks,
Sumesh

2. Registered User
Join Date
May 2005
Location
South Africa
Posts
1,369
The storage size for a numeric or decimal column depends on its precision
e.g.
select "prec"=colid, length=ceiling(colid/log10(256))+1
from syscolumns
where id=16 and colid<39
order by colid

3. Registered User
Join Date
Nov 2006
Posts
13

Can u pls explain what is actually meant by length of a column when we specify precision and scale as Numeric(12,3).

Thanks a lot
Sumesh

4. Registered User
Join Date
May 2005
Location
South Africa
Posts
1,369
Length is the storage size
i.e.
It takes ceiling(12/log10(256))+1=6 bytes to store a numeric(12,3)
Last edited by pdreyer; 01-23-07 at 08:42.

5. Registered User
Join Date
Nov 2006
Posts
13
Thanks a lot

6. Registered User
Join Date
Nov 2006
Posts
13
Originally Posted by pdreyer
Length is the storage size
i.e.
It takes ceiling(12/log10(256))+1=6 bytes to store a numeric(12,3)
.

But you have mentioned 'ceiling(colid/log10(256))+1'.
Please confirm how can you say that here column id =12.

7. Registered User
Join Date
May 2005
Location
South Africa
Posts
1,369