Programming in MS SQL Server 2012

Currency Data Type



Money and smallmoney data type is used to stores financial number. SQL Server is allocate 8 bytes memory to stores money data value from -922,337,203,685,477.5808 to 922,337,203,685,477.5807 and allocate 4 bytes memory to stores smallmoney data value from - 214,748.3648 to 214,748.3647. The following example describes a Smallmoney and Money Data Types.

-- Example 76 --

 

DECLARE @Salary SmallMoney

SET @Salary = 35000.1234

SELECT Salary = @Salary

 

DECLARE @CrossSalary Money,

        @SumOfBenifit Money,

        @SumOfDeduction Money,

        @NetSalary Money

SET @CrossSalary = 27000

SET @SumOfBenifit = 5000

SET @SumOfDeduction = 500

SET @NetSalary = (@CrossSalary + @SumOfBenifit) - @SumOfDeduction

SELECT 'Cross Salary' = @CrossSalary,

       'Sum Of Benifit' = @SumOfBenifit,

       'Sum Of Deduction' = @SumOfDeduction,

       'Net Salary Amount' = @NetSalary


Query Output Screen

* * * * *


Email Your Comment To AUTHOR