Convert from Access SQL to T-SQL 2005
Can anyone convert this sql access function for me to work in t-sql 2005.
I am trying to take the selling price minus the cost as one room. And divide that by the original sales price to produce the second number
Thanks:)
=IIf([Selling Price]=0,0,([Selling Price]-Nz([Cost]))/[Selling Price])
IIRC it should be something like:
ISNULL((ISNULL([Selling Price],0) - ISNULL(Cost,0)),0) / ISNULL([Selling Price],0) AS Margin
But here I am getting a break on Zero error.
any suggestions?
+2
a source to share
2 answers