Hi
We save file size in bytes,when selete data in sql query need to convert as mb and add word "MB" at end of result . This is data in "File Size" column in my table
File Size
25327668
9463163
1016575
1645595
11475
1. I am try following ways,if file size is below 20 mb then can get result,otherwise (25327668 this 24mb in bytes) it show error like
Msg 8115, Level 16, State 8, Line 4
Arithmetic overflow error converting nvarchar to data type numeric.
select convert(nvarchar(50),db.[File Size]/ 1048576.0 ) +' MB' as FSize from [thumbnaa] db
2.if i try like this ,then below 1mb always show 0,pls see screeshot
http://prntscr.com/9cdhyz[
^]
select convert(nvarchar(50),db.[File Size]/ (1024*1024) ) +' MB' as FSize from [thumbnaa] db
This one work finally,but i need to show only 2 digit after dot
convert(nvarchar(50) ,cast(db.[File Size] as numeric(35,2))/1048576.0 ) +' MB' as FSize
like this 24.15 MB
pls reply asap
Regards
Aravind