Moving from Oracle to SQL Server. I took some on-line classes to know more about SQL Server. Looks to me in setting up a table I should be using the smallest data type possible to do what I need. Makes sense, like with most other programming, right? So, if I have a table that I will not exceed 100 records (number of Counties in a state), I should be using [tt]tinyint[/tt] (0 to 255) or when setting a field with the County Name, the most I will ever need is 20 characters, so [tt]Varchar(20)[/tt] will do just fine.
But most of the examples I see in 'real world' is: set your number (PK field) data type to [tt]Int[/tt] (or, if you need bigger numbers, use [tt]Decimal[/tt]), for text just use [tt]Varchar(max)[/tt]. That will cover what you need and a lot more. SQL Server will use what it needs when it needs.
What’s the ‘right’ approach?
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
But most of the examples I see in 'real world' is: set your number (PK field) data type to [tt]Int[/tt] (or, if you need bigger numbers, use [tt]Decimal[/tt]), for text just use [tt]Varchar(max)[/tt]. That will cover what you need and a lot more. SQL Server will use what it needs when it needs.
What’s the ‘right’ approach?
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson