Search Result

Collapse
2 results in 0.0039 seconds.
Keywords
Members
Tags
c# smallint
  •  

  • ganeshkumar08
    started a topic What is the range for smallint

    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
    See more | Go to post

  • Mike
    Guest started a topic Casting problem with small int

    Casting problem with small int

    When using a DataReader to return records from a SQL server, I'm having a
    problem with the following code (abbreviated)

    int ID = 0;
    ID = (int)dr["user_id"];

    will work if the user_id column is an int field. The same code throws an
    invalid cast exception if the user_id column is a smallint. To fix the
    problem, this code works:

    int ID = 0;
    ID = (int)(smallint) dr["user_id"];...
    See more | Go to post
Working...