Solved

sql data types

Posted on 2014-01-27
6
377 Views
Last Modified: 2014-01-27
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
Comment
Question by:bfuchs
6 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 175 total points
Comment Utility
The Decimal type is always a good choice.
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 25 total points
Comment Utility
numeric(5,1)
0
 
LVL 16

Assisted Solution

by:Surendra Nath
Surendra Nath earned 50 total points
Comment Utility
decimal(18,2) will be a good fit
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 3

Author Comment

by:bfuchs
Comment Utility
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
 
LVL 16

Assisted Solution

by:Surendra Nath
Surendra Nath earned 50 total points
Comment Utility
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
 
LVL 3

Author Closing Comment

by:bfuchs
Comment Utility
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now