Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2008-03-08 : 17:02:29
|
| I want to show the filesize via select query, i have in teh Database: 26208032 but on the front end it is showing this:2.620803E+07, how can i convert the bits value which is in Database table and show it as KB's.select filesize from document_table.Thanks. |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2008-03-08 : 17:20:49
|
maybe select filesize and divide by 1000? Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-03-08 : 18:09:27
|
| And cast to decimal data type. |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-03-08 : 19:13:52
|
try dividing ba 1024 and not by 1000 _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2008-03-08 : 19:40:48
|
quote: Originally posted by spirit1 try dividing ba 1024 and not by 1000 
Forgive my ignorance on this one...in the sp_spaceusedbytable (found online) procedure, it converts the reserved_MB etc...by dividing by 1000Why 1024 in this case, so I can understand better? Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-03-08 : 19:55:23
|
| emm... well... we learned in school that:1kb = 1024 bytes1Mb = 1024 kb1Gb = 1024 Mbso my guess is that this is either an error on the part of the script autor or MS, because BOL states that sp_spaceused column database_size returns size in Mb.And i doubt it's an error by MS._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2008-03-08 : 20:47:41
|
I was just going by math, turning 1 million into 1 thousand you divide by 1000. No need to be sarcastic ;)the proc I referred to was from this site:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=10932where I have since noticed that the author (Nguyen) acknowledges that he is dividing by 1000 despite the actual bytes size being quote: 1028 or something
Certainly didn't mean to grow suddenly dense on that one :D I should note that I do actually know that everything is multiples of 8, I just missed that day of school..LOL  Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
|
|
|