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 Development (2000)
 integers oh my!

Author  Topic 

tribune
Posting Yak Master

105 Posts

Posted - 2005-10-11 : 01:16:59
Is it really worth it to specify tinyint, smallint, or regular int in SQL server?

It seems like this is a complete waste of time, not to mention exposes possible data type overflows down the road. For example, with ADO.net, you still convert smallint and tinyint to integer data types within your code.

I'd like to hear any good arguments in support for distinguishing between these three types in your databases. I can see the bit data type as being very helpful because its a constraint in and of itself.

While we're on the subject, does anyone ever use bigint for anything?

Its hard to imagine seeing the need to store a number like -2^63 (-9223372036854775808) through 2^63-1 (9223372036854775807).

;-)


byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2005-10-11 : 01:32:09
>> Is it really worth it to specify tinyint, smallint, or regular int in SQL server?
Yes

>> not to mention exposes possible data type overflows down the road.
This is a good thing! I'll let you figure out why

>> I'd like to hear any good arguments in support for distinguishing between these three types in your databases.

1) To follow your logical model
2) To enforce correctness
3) To annoy UI developers

>>While we're on the subject, does anyone ever use bigint for anything?
Yeah for big numbers..

DavidM

A front-end is something that tries to violate a back-end.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-10-11 : 05:05:48
OK, I'll ask this question and see if it answers your question!:

"What's the point of using 4 bytes, in the database, to store a value that is only allowed to be between 1 and 9"?

Now ... in the application might I choose to use an INT for working storage? Probably - particularly if it would otherwise involve an implicit cast to INT every time it was added / or otherwise processed.

Kristen
Go to Top of Page
   

- Advertisement -