Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What datatype should I use?

Status
Not open for further replies.

BobLoblaws

Programmer
Nov 20, 2001
149
CA
I am creating an order table that will hold an average of 60 million records for each year, and expected to contain 5 years worth of data. So I'm looking at approximately 300 million records for the table.
What is the best datatype to use for creating a Unique OrderID? Should it be numeric, float, real, etc.

Much appreciated. :cool:
 
I'm not sure it is best, but I would suggest integer. Numeric, float and real all allow decimals and therefore use some extra storage to maintian that part of the number. An int takes 4 bytes, float and real take 4 or 8 bytes and a numeric takes at least 5 bytes.

Michael
 
What is the largest value that an int can hold in SQL Server?
 
3 billion-ish. Do you have access to SQL Server Books Online? It describes all the data types.

Michael
 
Actually, Int is limited to 2^31 - 1 or about 2 billion. Bigint is limited to 2^63 - 1 (9,223,372,036,854,775,807). I don't think you'd have a problem using either data type. Int should be good for about 35 years. Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top