A well known solution is when dividing A / B to do something like this:
= IIF( IsNothing( B )
OR B = 0,
0,
A
/
IIF( IsNothing( B )
OR B = 0,
1,
B
)
)
Writing this each and every time gets a little annoying. With the not so good code editor in BIDS when we have complex expressions instead of “A” and “B” it can actually be very frustrating and unnecessarily time consuming.
Having to do this over and over again I made a small and very simple tool I would like to share.
All you need to do is put the required values in the top and bottom. Click [Generate] and copy the result.
It saves some time and I hope someone finds it useful.
Download from here.
Source (VS 2010)