Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Order of the precedence of arithmetic operator is overruled when using curreny symbols

Apr 22 2013 12:00AM by Madhivanan   

The currency symbol $ represents the value 0. Find more examples at http://beyondrelational.com/modules/1/justlearned/tips/8577/arithmetic-operations-with-.aspx 

The datatype of the returned value from $ is money.

Consider the following example

declare @m money
set @m=0
select @m/@m+1

As you guess the result is the error that says Divide by zero error encountered because @m/@m is executed first and then 1 is added but @m/@m results in the error. As there is no braces in the expression and the order of precedence is division and addition.

When you run the following code

declare @m money
set @m=0
select @m/(@m+1)

The result is 0 because the expression @m+1 is executed first so you do not get Divide by Zero error

Well. When you execute select $/$ you get error but when you execute the following code

select $/$+1 

Instead of throwing an error divide by zero, it returns the value 0. The order of precednece is overruled and it is executed as if $/($+1).

I never use currency symbols in the expressions like the above example. But I just noticed this. Has anyone observed this?

Tags: 


Madhivanan
2 · 40% · 13039
4
 
0
Lifesaver
 
0
Refreshed
 
 
0
Incorrect



Submit

3  Comments  

  • Very nice article. But why is order of precedence is overruled for $ ? Can you shed some light on this ?

    Imran

    commented on Apr 22 2013 6:37AM
    mimran18
    1640 · 0% · 12
  • A person who knows the concept of the operators and symbols will only understand all the things that is mentioned here.

    commented on Apr 24 2013 6:55AM
    Rogerfee
    3160 · 0% · 2
  • Now guess, what will be the result of following statement then????

    select $5/$5+1

    It will follow the order of precedence..Sure

    commented on Jun 13 2013 2:40AM
    qaisi786
    888 · 0% · 33

Your Comment


Sign Up or Login to post a comment.

"Order of the precedence of arithmetic operator is overruled when using curreny symbols" rated 5 out of 5 by 4 readers
Order of the precedence of arithmetic operator is overruled when using curreny symbols , 5.0 out of 5 based on 4 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]