Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 394
  • Last Modified:

sql data types

hi, what is the ideal data type in sql 2005 to store numbers and half numbers, like 1,1.5,2,2.5 etc...?
0
bfuchs
Asked:
bfuchs
4 Solutions
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
The Decimal type is always a good choice.
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
numeric(5,1)
0
 
Surendra NathCommented:
decimal(18,2) will be a good fit
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
bfuchsAuthor Commented:
hi, by default it comes as decimal(18, 0), what are those values in parenthesis?
also i had it currently stored all as int, is it safe to just change the data type manually?
0
 
Surendra NathCommented:
the decimal data type is defined as below
decimal(p,s)

p--> precision (total number of digits in the number including the fractional numbers)
s--> scale (total number of fractional numbers)

More about this can be found here
http://msdn.microsoft.com/en-us/library/ms187746.aspx

Yes, it is safe to convert Int to decimal ( but not the other way around)
0
 
bfuchsAuthor Commented:
Hi experts,
Not sure if I am awarding properly the points here:)
Will use the decimal option since the majority here are for it.
Really appreciate your quick responses,
Ben
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Tackle projects and never again get stuck behind a technical roadblock.
Join Now