
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 04:14 PM
Why this works:
But this:
Causes Error: Expression evaluation caused an overflow. [ Name of function (if known) = ]
Convert(Decimal(2,1),tblDiskdrives.Freespace / 1024 / 1024 / 1024)
But this:
Convert(Decimal(2,1),tblDiskdrives.Size / 1024 / 1024 / 1024)
Causes Error: Expression evaluation caused an overflow. [ Name of function (if known) = ]
Solved! Go to Solution.
Labels:
- Labels:
-
Report Center
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 06:22 PM
Probably because you got lucky and only had small values of Freespace.
Try the function manually and you'll find that
Is there a particular reason why you want to restrict display output to values < 10? If you're just wanting to display the value with one decimal place, consider replacing the size parameter (2 in your example) with something much larger than you're ever likely to see. I believe the default is Decimal(18,0), so why not just specify Decimal(18,1) to get the one decimal you seem to be after? That would cover you up to 99,999,999,999,999,999.94.
Try the function manually and you'll find that
Convert(Decimal(2,1), 9.94)will produce 9.9, but
Convert(Decimal(2,1), 9.95)will produce as overflow error. Allow a larger value
Convert(Decimal(and the result is 10.0.3 ,1), 9.95)
Is there a particular reason why you want to restrict display output to values < 10? If you're just wanting to display the value with one decimal place, consider replacing the size parameter (2 in your example) with something much larger than you're ever likely to see. I believe the default is Decimal(18,0), so why not just specify Decimal(18,1) to get the one decimal you seem to be after? That would cover you up to 99,999,999,999,999,999.94.
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2016 07:21 AM
Thanks, it was that simple. I was creating a report showing workstation less than 5 GB disk free and wanted to show GB instead of bytes. 18,1 works just like I needed.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2016 06:22 PM
Probably because you got lucky and only had small values of Freespace.
Try the function manually and you'll find that
Is there a particular reason why you want to restrict display output to values < 10? If you're just wanting to display the value with one decimal place, consider replacing the size parameter (2 in your example) with something much larger than you're ever likely to see. I believe the default is Decimal(18,0), so why not just specify Decimal(18,1) to get the one decimal you seem to be after? That would cover you up to 99,999,999,999,999,999.94.
Try the function manually and you'll find that
Convert(Decimal(2,1), 9.94)will produce 9.9, but
Convert(Decimal(2,1), 9.95)will produce as overflow error. Allow a larger value
Convert(Decimal(and the result is 10.0.3 ,1), 9.95)
Is there a particular reason why you want to restrict display output to values < 10? If you're just wanting to display the value with one decimal place, consider replacing the size parameter (2 in your example) with something much larger than you're ever likely to see. I believe the default is Decimal(18,0), so why not just specify Decimal(18,1) to get the one decimal you seem to be after? That would cover you up to 99,999,999,999,999,999.94.
