Wednesday, 3 February 2016

Divide by zero error encountered in sql




--// Details

SELECT COALESCE(SUM(isnull(ColumnName,0)) / NULLIF(SUM(isnull(ColumnName,0)),0), 0)

--// Function

SELECT COALESCE(SUM(isnull(0,0)) / NULLIF(SUM(isnull(0,0)),0), 0)

--// Result

0.000000

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...