April 26, 2011 at 10:18 am
This is embarrassing to ask, but I just can't find a clear answer. First, this article seems pretty clear in explaining Decimal vs Binary, and mebibyte (binary) vs. megabyte (decimal), etc. http://www.t1shopper.com/tools/calculate/[/url]
But if you look at the File Storage Capacity by Bits and Bytes chart, it says that 1 Gigabyte is 1,024 Megabytes.
Then look at the New IEC Standard chart and it shows that 1 gigabyte (decimal), is 1000 megabytes.
You would have to have 1 gibibyte (binary), to get 1024 mebibytes.
What's up with that? Why is a Gigabyte 1024 Megabytes, yet a gigabyte is 1000 megabytes? What am I missing?
And here's the SQL question. If you google this exact phrase...
This step required as 'convert.../1000' cannot be used with varchars
...you find a few people who use a formula like this:
convert(decimal (8,2), (reserved * d.low / 1024.)/1000)
OK why are we dividing by both 1024 and 1000? Is that right? Dang that's confusing!
One final question... if you look at sys.master_files table, the size of a file is stored in "8-KB Pages". So what would I do if I wanted the file size in MB? How about GB??
Thanks!!
April 26, 2011 at 10:31 am
jpSQLDude (4/26/2011)
This is embarrassing to ask, but I just can't find a clear answer. First, this article seems pretty clear in explaining Decimal vs Binary, and mebibyte (binary) vs. megabyte (decimal), etc. http://www.t1shopper.com/tools/calculate/[/url]But if you look at the File Storage Capacity by Bits and Bytes chart, it says that 1 Gigabyte is 1,024 Megabytes.
Then look at the New IEC Standard chart and it shows that 1 gigabyte (decimal), is 1000 megabytes.
You would have to have 1 gibibyte (binary), to get 1024 mebibytes.
What's up with that? Why is a Gigabyte 1024 Megabytes, yet a gigabyte is 1000 megabytes? What am I missing?
And here's the SQL question. If you google this exact phrase...
This step required as 'convert.../1000' cannot be used with varchars
...you find a few people who use a formula like this:
convert(decimal (8,2), (reserved * d.low / 1024.)/1000)
OK why are we dividing by both 1024 and 1000? Is that right? Dang that's confusing!
One final question... if you look at sys.master_files table, the size of a file is stored in "8-KB Pages". So what would I do if I wanted the file size in MB? How about GB??
Thanks!!
I'll answer just some of this. Firstly, you must use capitals when abbreviating gigabyte (so GB, not gb or any other combination). That's because 'g' means 'grams' and 'b' means 'bits', using standard abbreviations.
The original definition of a GB was 1024 ^3 bytes and that is what you should consider the 'default' definition.
However, hard disk manufacturers have decided to adopt a GB as being 10^9 bytes, perhaps because this is a lower number than the above (and therefore allowing them to quote a higher GB disk capacity than under the standard definition).
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
April 27, 2011 at 2:52 pm
Size of a file is stored in "8-KB Pages". So what would I do if I wanted the file size in MB? How about GB?
pages/128 = MB
pages/(128*1024) = GB
Convert pages to DECIMAL(25,13) for max precision.
HDD manufacturers are cheating us by 10% giving us 10% smaller disk capacity than they claim it has,
since the disk they say has 1 TB (= 1024^4 = 1.099.511.627.776 B), actually has 1.000.000.000.000 B.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply