Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8950399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:26:49+00:00 2026-06-15T13:26:49+00:00

Possible Duplicate: How to avoid the divide by zero error in SQL? I have

  • 0

Possible Duplicate:
How to avoid the “divide by zero” error in SQL?

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.

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:26:50+00:00Added an answer on June 15, 2026 at 1:26 pm

    Replace expressions like (TotalAreaSqm/10000) with (nullif(TotalAreaSqm,0)/10000)

    This assumes you would like the result to be null in the case of division by zero. See the docs here for a description of nullif.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Why avoid while loops? I am trying to learn Python by following
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Why avoid increment (“++”) and decrement (“--”) operators in JavaScript? I've heard
Possible Duplicate: How to avoid “!= null” statements in Java? Share your thoughts..
Possible Duplicate: .NET Controls: Why aren’t all calls thread-safe? This question is not about
Possible Duplicate: PHP, Echoing an array into a string of comma seperated values This
Possible Duplicate: Scanner issue when using nextLine after nextInt I am creating a client
Possible Duplicate: is there a way to avoid calling nextval() if the insert fails
Possible Duplicate: Java floats and doubles, how to avoid that 0.0 + 0.1 +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.