MS SQL data type length

Reply

Join Date: Jun 2005
Posts: 92
Reputation: michael123 is an unknown quantity at this point 
Solved Threads: 0
michael123 michael123 is offline Offline
Junior Poster in Training

MS SQL data type length

 
0
  #1
Jul 14th, 2006
When I try to use MS SQL Server Enterprise Manager to create table, I typed column name, data type as "int", however the length of "int" is 4, that is fixed I cannot change, now the problem is I need to use this column as record ID, my database is large, the number of the records is more than 9999(which is the maximum int 4 length), how can I solve this issue? thanks for any comment.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: MS SQL data type length

 
0
  #2
Jul 21st, 2006
you are confused, int is not limited to less than 10,000 in sql server. the limit is around 2 billion. (2^31)-1 to be precise
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: MS SQL data type length

 
0
  #3
Jul 21st, 2006
Yes 4 relate to how many bytes int uses in ram per value
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: MS SQL data type length

 
0
  #4
Jul 21st, 2006
correct. 4 bytes * 8 bits = 32 bits. hence it has a range from -2^31 to +2^31
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 92
Reputation: michael123 is an unknown quantity at this point 
Solved Threads: 0
michael123 michael123 is offline Offline
Junior Poster in Training

Re: MS SQL data type length

 
0
  #5
Jul 21st, 2006
Thank you very much for pointing it out, I was confused.
Reply With Quote Quick reply to this message  
Join Date: Dec 2009
Posts: 1
Reputation: Nemesis80 is an unknown quantity at this point 
Solved Threads: 0
Nemesis80 Nemesis80 is offline Offline
Newbie Poster
 
0
  #6
13 Days Ago
Friend of mine INT 4 in sql server means that it uses 4 bytes if you multiply it by 8 bits each one they are 32 bits with what you can store numbers of the order from-2^31 (-2.147.483.648) to 2^31-1 (2.147.483.647)

see it

http://technet.microsoft.com/en-us/l.../ms187745.aspx

bye

Originally Posted by michael123 View Post
When I try to use MS SQL Server Enterprise Manager to create table, I typed column name, data type as "int", however the length of "int" is 4, that is fixed I cannot change, now the problem is I need to use this column as record ID, my database is large, the number of the records is more than 9999(which is the maximum int 4 length), how can I solve this issue? thanks for any comment.
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 18787 | Replies: 5
Thread Tools Search this Thread



Tag cloud for MS SQL
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC