Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to avoid divided by zero error
    text
    copied!<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/861778/how-to-avoid-the-divide-by-zero-error-in-sql">How to avoid the “divide by zero” error in SQL?</a> </p> </blockquote> <p>I have an issue regarding Sql Server divided by zero error. Sometimes this error and the view it's blocked until I delete the respective row. Can you please help me and give me some advices in how could I avoid this? Thanks.</p> <pre><code>CREATE VIEW Acq AS SELECT ac_id ,[Company] ,No ,[ContractID] ,[Seller] ,[AcquistionDate] ,[Village] ,[Commune] ,[Area] ,[PlotArea] ,[FieldNo] ,[Topo1] ,[Topo2] ,[Topo3] ,[Topo4] ,[Topo5] ,[TotalAreaSqm] ,[OwnershipTitle] ,[CadastralNO] ,[Type] ,[Price] ,[NotaryCosts] ,[LandTax] ,[OtherTaxes] ,[AgentFee] ,[CadastralFee] ,[TabulationFee] ,[CertSarcini] ,[ProcuraNO] ,cast((isnull(price,0)+isnull(notarycosts,0)+isnull(landtax,0)+isnull(othertaxes,0)+isnull(agentfee,0)+isnull(cadastralfee,0)+isnull(tabulationfee,0)+isnull(certsarcini,0)) as decimal(12,4)) as TotalCosts ,cast((isnull(price,0)+isnull(notarycosts,0)+isnull(landtax,0)+isnull(othertaxes,0)+isnull(agentfee,0)+isnull(cadastralfee,0)+isnull(tabulationfee,0)+isnull(certsarcini,0))/(TotalAreaSqm/10000) as decimal(12,4)) as RonPerHa ,cast((isnull(price,0)+isnull(notarycosts,0)+isnull(landtax,0)+isnull(othertaxes,0)+isnull(agentfee,0)+isnull(cadastralfee,0)+isnull(tabulationfee,0)+isnull(certsarcini,0))/(TotalAreaSqm/10000*FixHist) as decimal(12,4)) as EurPerHa ,[DeclImpunere] ,[FixHist] ,cast((isnull(price,0)+isnull(notarycosts,0)+isnull(landtax,0)+isnull(othertaxes,0)+isnull(agentfee,0)+isnull(cadastralfee,0)+isnull(tabulationfee,0)+isnull(certsarcini,0))/FixHist as decimal(12,4)) as EurHist ,[LandStatus] FROM tblAcq </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload