Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 unsigned integers

Author  Topic 

lineonmu
Starting Member

3 Posts

Posted - 2008-05-27 : 12:58:50
there are unsigned integers in SQL Server 2000? I found only signed integers ...

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-05-27 : 12:59:32
What?? Didn't get it
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-27 : 12:59:39
There is no such unsigned integer data type in SQL Server, however you can constrain your data if you use check constraints.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

lineonmu
Starting Member

3 Posts

Posted - 2008-05-27 : 13:03:05
I can create an integer with its max value 65535?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-27 : 13:05:29
Here are the integer data types, from BOL:

quote:

Data type Range Storage
bigint
-2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)
8 Bytes

int
-2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)
4 Bytes

smallint
-2^15 (-32,768) to 2^15-1 (32,767)
2 Bytes

tinyint
0 to 255
1 Byte



Then put a check constraint on the column to constrain the data to the range you want.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page

lineonmu
Starting Member

3 Posts

Posted - 2008-05-27 : 13:12:57
quote:
Originally posted by tkizer

Here are the integer data types, from BOL:

quote:

Data type Range Storage
bigint
-2^63 (-9,223,372,036,854,775,808) to 2^63-1 (9,223,372,036,854,775,807)
8 Bytes

int
-2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647)
4 Bytes

smallint
-2^15 (-32,768) to 2^15-1 (32,767)
2 Bytes

tinyint
0 to 255
1 Byte



Then put a check constraint on the column to constrain the data to the range you want.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx



so for the range 0 - 65535 I can use int but for this range what I can do?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-05-27 : 13:15:07
Add a check constraint to it. Look up check constraints in SQL Server Books Online if you don't understand what I mean.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx
Go to Top of Page
   

- Advertisement -