Getting size of Numeric(x,y) from table column

Getting size of Numeric(x,y) from table column

Post by Greg Strau » Fri, 21 Nov 1997 04:00:00



Hi,

If I have a column in the database defined as DECIMAL(8,3)
[or NUMERIC(8,3)], how can I (using rdo) find out the size of the
(8,3) part. I can easily get the fact that it's a DECIMAL data type
via rdoColumn object, but I can't seem to get the scale and precision
portions....

Thanks!

----------------------------------------------------
Greg Strauss
Visionary Solutions Corp.
Victoria, BC

(remove abc above for email address)

 
 
 

Getting size of Numeric(x,y) from table column

Post by Bob Donle » Sun, 23 Nov 1997 04:00:00


You can get what you're looking for from SQL.

Here's a rough cut:

  Dim rs As rdoResultset
  Dim SQLStatement As String

  SQLStatement = "Select b.name, b.prec, b.scale " & _
                 " from sysobjects a, syscolumns b " & _
                 " where a.name='tPlan' and (b.id = a.id)"

  Set rs = g_rdoConnection.OpenResultset(SQLStatement, rdOpenForwardOnly)

  Do While Not rs.EOF
    Debug.Print rs!Name, rs!prec, rs!Scale
    rs.MoveNext
  Loop

  rs.Close

The result:

PlanNumber     6            Null
PlanName       32           Null
Administrator  30           Null
Salary         8             3



>Hi,

>If I have a column in the database defined as DECIMAL(8,3)
>[or NUMERIC(8,3)], how can I (using rdo) find out the size of the
>(8,3) part. I can easily get the fact that it's a DECIMAL data type
>via rdoColumn object, but I can't seem to get the scale and precision
>portions....

>Thanks!

>----------------------------------------------------
>Greg Strauss
>Visionary Solutions Corp.
>Victoria, BC

>(remove abc above for email address)


 
 
 

1. Size of Numeric Data Columns

When I do a sp_help on a table with a column defined as numeric(2), the
length comes up as 5.

Is this the actual storage size of the column?  I would assume that it would
be 2 and follow
the table documented for database size calculation where:

PRECISION           SIZE
0-2                          2
3-4                          3
5-7                          4
8-9                          5
...
37-38                      17

Could someone explain this to me?

Thanks.

2. Best tools and platform for ORACLE8 databasa

3. Getting rid of the IDENTITY property on a column withou getting rid of the column

4. US-CA-FINANCIALS APPLICATIONS DEVELOPER

5. Table size estimates and column sizes

6. Do you know a query that does what I want ?

7. alternate column names or column size through sql-create-table

8. AN: ASADAC new beta release is available.

9. "Selected table lacks required numeric columns"

10. Converting a numeric column into an alphanumeric column

11. Problems joining a numeric(31,0) column with a varchar(31) column

12. Copy numeric column to new char column

13. Getting size of tables.