Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everybody,

I know that we can use FLOAT or DECIMAL instead of DOUBLE datatype in sql server. But I want to know why double datatype is not included in SQL SERVER. What is the reason for that?

THANKS IN ADVANCE
Posted

Simple: it defines datatypes based on it's own data storage size, not the storage units used by the machine it is installed on, or that it's clients are using.

Think about it: how big is an integer?
For early C, is was 16 bits. For a "modern" compiler, it is 32 bits, but a longer 64 bit version is often available - but it depends on the machine the application is compiled for.

For SQL, it defines the size of it's values in terms of how much space they take up in the database and allows you to select how many bits of those are mantissa up to 53 bits, which changes the storage from 4 bytes to 8 bytes as needed. For larger values, it provides the DECIMAL type, which has a variable storage size between 4 and 17 bytes, and allows a more precise value to be stored: up to 38 decimal digits!

float and double are names used within programming languages which (sometimes) allow larger values - but not always, the language specification does not always specify how "big" a value it is. C# does, C doesn't.
 
Share this answer
 
Double type (i.e. 64 bits floating point real) does exist in SQL Server : that is the float(53) datatype.

More exactly, datatype float(1) to float(24) are stored with 4 bytes (32 bits), whereas float(25) to float(53) are stored with 8 bytes (64 bits).

You can find more info on float datatype here:
float and real (Transact-SQL)[]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900