Login     Register

        Contact Us     Search

XLeratorDB/financial Documentation

SQL Server DB function


DB
 
Updated: 5 August 2010
Use DB to calculate the depreciation of an asset for a specified period using the fixed-declining balance method.
 
Syntax
SELECT [westclintech].[wct].[DB] (
   <@Cost, float,>
 ,<@Salvage, float,>
 ,<@Life, float,>
 ,<@Per, int,>
 ,<@MonthsInFirstYear, int,>)
Arguments
@Cost
the total acquisition cost of the asset. @Cost is an expression of type float or of a type that can be implicitly converted to float.
@Salvage
the estimated value of the asset at the end of the depreciation period. @Salvage is an expression of type float or of a type that can be implicitly converted to float.
@Life
the estimated useful life of the asset. @Life is an expression of type float or of a type that can be implicitly converted to float.
@Per
the period for which the depreciation is being calculated. To obtain meaningful results, the calendar unit used for period and the calendar unit used for life should be the same. If depreciation for a month is being calculated then the life should be expressed as a number of months. If depreciation for a quarter is being calculated, then the life should be expressed in quarters. @Per is an expression of type int or of a type that can be implicitly converted to int.
@MonthsInFirstYear
the number of months in the first year. If NULL, it is assumed to be 12. @MonthsInFirstYear is an expression of type int or of a type that can be implicitly converted to int.
Return Type
float
Remarks
·         The fixed-declining balance method computes depreciation at a fixed rate. DB uses the following formulas to calculate depreciation for a period:
 
(@Cost - total depreciation from prior periods) * rate
 
Where:
 
rate = 1 - ((@Salvage / @Cost) ^ (1 / @Life)), rounded to three decimal places
 
·         Depreciation for the first and last periods is a special case. For the first period, DB uses this formula:
 
@Cost * rate * @MonthsInFirstYear / 12
 
·         For the last period, DB uses this formula:
 
((@Cost - total depreciation from prior periods) * rate * (12 - @MonthsInFirstYear)) / 12
 
Examples
 
SELECT wct.DB(600000
,0
,4
,1
,3)
Here is the result set
----------------------

150000



Copyright 2008-2013 WestClinTech LLC         Privacy Policy        Terms of Service