Results 1 to 3 of 3

Thread: NUMERIC vs INT

  1. #1
    Join Date
    Sep 2003
    Posts
    7

    Unanswered: NUMERIC vs INT

    Hi,

    As I understand, INT data type is 4 bytes datatype while numeric data type can be 2-17 bytes in size.

    I wonder how we can determine the size of the numeric data type (in byte)? For example,
    NUMERIC ( 5 ) - how many bytes? NUMERIC ( 7, 2) -how many bytes?

    Please help

    Thank you in advance.

  2. #2
    Join Date
    Sep 2002
    Location
    Germany, near Aachen
    Posts
    120
    Simplest way to get those informations is to create a table and use sp_help to display the sizes of the fields:


    1> create table test1 (f1 numeric(5), f2 numeric(7,2))
    2> go
    1> sp_help test1
    2> go
    Name Owner Type
    ------------------------------ ------------------------------ ----------------------
    test1 dbo user table

    (1 row affected)
    Data_located_on_segment When_created
    ------------------------------ --------------------------
    default Nov 18 2003 8:35AM
    Column_name Type Length Prec Scale Nulls Default_name Rule_name Identity
    --------------- --------------- ------ ---- ----- ----- --------------- --------------- --------
    f1 numeric 4 5 0 0 NULL NULL 0
    f2 numeric 4 7 2 0 NULL NULL 0


    The length column tells you the number of bytes.

  3. #3
    Join Date
    Sep 2003
    Posts
    7
    Great, I got it.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •