Need to see if I can get a smallint to go from 0 to 64000 and not -32000 to 32000

Need to see if I can get a smallint to go from 0 to 64000 and not -32000 to 32000

Post by jack » Wed, 15 Oct 2003 04:48:11



Hello,

I want to have an integer that is 64K, but no negitives?  Smallint will
do -32000 to 32000, but I would like to have 0 to 64000.

Thanks,

Jack

 
 
 

Need to see if I can get a smallint to go from 0 to 64000 and not -32000 to 32000

Post by lindawi » Wed, 15 Oct 2003 04:56:25


jack,

Quote:> I want to have an integer that is 64K, but no negitives?
> Smallint will do -32000 to 32000, but I would like to have 0 to
> 64000.

Then you'll have to use an INT (long integer). SQL Server does not
support unsigned integer data types.

Linda

 
 
 

Need to see if I can get a smallint to go from 0 to 64000 and not -32000 to 32000

Post by Daran Johnso » Wed, 15 Oct 2003 05:07:39


Jack,

I would suggest using an integer and placing a check constraint on the
column that will not allow values less than zero or greater than 64000.

Daran


Quote:> Hello,

> I want to have an integer that is 64K, but no negitives?  Smallint will
> do -32000 to 32000, but I would like to have 0 to 64000.

> Thanks,

> Jack

 
 
 

Need to see if I can get a smallint to go from 0 to 64000 and not -32000 to 32000

Post by Kalen Delane » Wed, 15 Oct 2003 06:29:40


The values in the column have to be -32K to 32K, but you could just add 32K
to every value before you used it.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com


Quote:> Hello,

> I want to have an integer that is 64K, but no negitives?  Smallint will
> do -32000 to 32000, but I would like to have 0 to 64000.

> Thanks,

> Jack

 
 
 

Need to see if I can get a smallint to go from 0 to 64000 and not -32000 to 32000

Post by Anthony Faul » Thu, 16 Oct 2003 13:04:45


There is no unsigned smallint but you have a few alternatives:
1. Use an int with a check constraint. That would save you worlds of pain.
Downside is that you use 4 bytes instead of 2.
2. Use a binary(2). You can still insert integer values, but the default
output is hexadecimal, and you can't make it an identity column.
3. Use a smallint. You need to subtract 32768 when inserting, and add 32768
when selecting. This can be confusing though.


Quote:> Hello,

> I want to have an integer that is 64K, but no negitives?  Smallint will
> do -32000 to 32000, but I would like to have 0 to 64000.

> Thanks,

> Jack

 
 
 

1. 32000 records in a table? need more

we have a problem
it appears that there is a max of 32767 records allowed in a Paradox
table.  
but we need more....much more....

what can we do?
use another table type?
some setting to change it to much more?

we also can't find anywhere that this value is specified in the help
or documentation (D5 pro) , else we would have known before we
started and used something else or used a different design to
accomodate our dataset.

please help

steam and wind

--
       David Forsyth -:- the email address is real, but cunning!
Keeper of the listserver for South African Railways fans   _|_ His
Part time gricer, kiter, photographer, metalworker etc.     |  Way
    http://terrapin.ru.ac.za/satrain/                       |  Up
       Don't make it accurate, make it adjustable



2. word spelling numeric

3. Truncate does not work using Compaq 3200 RAID Array Contoller

4. FPW26 Desktop

5. Data type for 32000 characters

6. Oracle DBA-Seattle-AT&T Wireless

7. Embedded SQL error -32000

8. dbase on two systems

9. Complex calculated member (more than 64000 children in a dimension)

10. Multiuser locking error (3200)

11. Cannot install client utilities on dell inspiron 3200

12. job schedule with 3200 Character limit

13. Increase 3200 character limitation in job step command?