Skip to content

Instantly share code, notes, and snippets.

@azcoov
Created August 16, 2011 06:57
Show Gist options
  • Save azcoov/1148574 to your computer and use it in GitHub Desktop.
Save azcoov/1148574 to your computer and use it in GitHub Desktop.
SQL Money Data Type Scale example
DECLARE
@mon1 MONEY ,
@mon2 MONEY ,
@mon3 MONEY ,
@mon4 MONEY ,
@num1 DECIMAL ( 19 , 4 ),
@num2 DECIMAL ( 19 , 4 ),
@num3 DECIMAL ( 19 , 4 ),
@num4 DECIMAL ( 19 , 4 )
SELECT
@mon1 = 100 , @mon2 = 339 , @mon3 = 10000 ,
@num1 = 100 , @num2 = 339 , @num3 = 10000
SET @mon4 = @mon1 / @mon2 * @mon3
SET @num4 = @num1 / @num2 * @num3
SELECT
@mon4 AS moneyresult ,
@num4 AS decimalresult
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment