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

Beware of Implicit conversions

Jan 16 2008 10:51AM by Madhivanan   

Sometimes you may wonder why integer divisions are not giving exact result Consider this example

Select 3/4

Select 4/3

Because both numerator and denominators are INTegers, results 0.75, 1.3333 are truncated to integers resulting 0 and 1 respectively Suppose you want to find out percentage number of orders taken for each shipcity against total orders

select shipcity,count(*)/(select count(*) from northwind..orders)*100  as percentage
from northwind..orders
group by shipcity

The result of percentage column is 0To avoid this, you need to convert one of the openrands by float ,decimal or multiply by 1.0

Select 3*1.0/4

Select 4*1.0/3


select shipcity,count(*)*1.0/(select count(*) from northwind..orders)*100 as percentage
from northwind..orders
group by shipcity

Tags: t-sql, sql_server, implicit_convertion,


Madhivanan
3 · 40% · 12936
1 Readers Liked this
Madhivanan Liked this on 4/17/2012 5:00:00 AM
Profile · Blog · Facebook · Twitter
1
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Beware of Implicit conversions" rated 5 out of 5 by 1 readers
Beware of Implicit conversions , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]