Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2003
    Posts
    11

    Unanswered: Want to know size in bytes taken by each dataType Sybase supports.

    Hello ,

    I would like to know the size in bytes required internally for each datatype sybase supports.

    For eg.
    I think for TINYINT its 1 bytes

    Would like to know the size in bytes for
    TINYINT, NUMERIC, DOUBLE PRECISION, VARCHAR, DATETIME, IMAGE, DECIMAL, INTEGER

    Thanks..

  2. #2
    Join Date
    Jan 2004
    Posts
    19
    you can get it from length column of systypes table(in case of char,varchar etc.. it gives the max storage length).

  3. #3
    Join Date
    Feb 2004
    Location
    Norway
    Posts
    7

    Re: Want to know size in bytes taken by each dataType Sybase supports.

    Originally posted by sangramd
    Hello ,

    I would like to know the size in bytes required internally for each datatype sybase supports.

    For eg.
    I think for TINYINT its 1 bytes

    Would like to know the size in bytes for
    TINYINT, NUMERIC, DOUBLE PRECISION, VARCHAR, DATETIME, IMAGE, DECIMAL, INTEGER
    The storage sizes of the datatypes are very clearly stated in the manual: http://sybooks.sybase.com/onlinebook...426;pt=15426#X

    You can also use the sp_help function, e.g. "sp_help datetime".

    The size of a varchar column will of course vary with the length of the string you put in it, the same applies to image - but this is all explained excellently in the manual.

    Olav

  4. #4
    Join Date
    Jul 2003
    Posts
    11

    Re: Want to know size in bytes taken by each dataType Sybase supports.

    Thanks Olav,

    But there is still some confusion over datatypes like 'Numeric'

    Documentation says that bytes of storage for the same are
    2 to 17
    Does this mean that variable storage size will be assigned depending on actual size of numeric data being stored in column ?
    Something like varchar.

    whereas sp_help(numeric) returns 17
    This suggests that fixed storage size of 17 bytes will be allocated internally regardless of data stored at runtime.

    Please let me know what is the exact storage behavior for sybase in case of NUMERIC.

    Sangram ..



    Originally posted by ogk
    The storage sizes of the datatypes are very clearly stated in the manual: http://sybooks.sybase.com/onlinebook...426;pt=15426#X

    You can also use the sp_help function, e.g. "sp_help datetime".

    The size of a varchar column will of course vary with the length of the string you put in it, the same applies to image - but this is all explained excellently in the manual.

    Olav

  5. #5
    Join Date
    Aug 2002
    Location
    Madrid, Spain
    Posts
    97

    Re: Want to know size in bytes taken by each dataType Sybase supports.

    Originally posted by sangramd
    But there is still some confusion over datatypes like 'Numeric'

    Documentation says that bytes of storage for the same are
    2 to 17
    Does this mean that variable storage size will be assigned depending on actual size of numeric data being stored in column ?
    Yes, numeric columns have different storage
    needs, according to the precision defined. The
    scale, on the other hand, doesn't matter.

    My advice is to create a table on tempdb with
    the numeric columns defined as you are
    interested in. Then run sp_help to see how
    the table was created. For each column, ASE
    will report the length, which is the number of
    storage bytes needed (the cost of representing
    NULL values, when allowed, is not included in
    this length column).

    FWIW, I think the storage required for a numeric
    col is given by the minimum number of bytes required
    to store an integer value whose decimal value has as
    many digits as the precision.

    Regards,
    Mariano Corral

  6. #6
    Join Date
    Feb 2004
    Location
    Norway
    Posts
    7

    Re: Want to know size in bytes taken by each dataType Sybase supports.

    Originally posted by sangramd
    Please let me know what is the exact storage behavior for sybase in case of NUMERIC.
    On the same page that I linked to above, the text reads:

    "The storage size for a numeric or decimal column depends on its precision. The minimum storage requirement is 2 bytes for a 1- or 2-digit column. Storage size increases by 1 byte for each additional 2 digits of precision, to a maximum of 17 bytes."

    I.e. a numeric(9,0) would take 6 bytes.

    Olav

Posting Permissions

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