Okay, I know this is uber-geek so no need to mention that in the comments
But I was searching for an easy way to prevent division by zero in a division operation in a (MS)SQL SELECT statement, and this popped out as a great way to do so. Use at your own risk of also being branded a geek, and being forced into a world of Star Trek collectables
ISNULL( NULLIF( your_field, 0 ), 1 )

November 19th, 2008
Related posts