What is the range for smallint

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ganeshkumar08
    New Member
    • Jan 2008
    • 31

    What is the range for smallint

    Hi SQL Friends

    I know that smallint ranges from -32768 to 32767 i.e from negative to positive values. why cant i store only positive values upto 65535.

    i need to store upto 50000 range data, for thins i cant go for int because it occupy 4 bytes. it is waste of memory.

    ok thanks
    Ganesh
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Originally posted by ganeshkumar08
    Hi SQL Friends

    I know that smallint ranges from -32768 to 32767 i.e from negative to positive values. why cant i store only positive values upto 65535.

    i need to store upto 50000 range data, for thins i cant go for int because it occupy 4 bytes. it is waste of memory.

    ok thanks
    Ganesh
    Yes you will not be able to store the value 50,000 because SMALLINT can hold the values from -32767 to +32767.

    You need to go for INT datatype

    Comment

    • ganeshkumar08
      New Member
      • Jan 2008
      • 31

      #3
      ok thanks for your response...

      Comment

      Working...