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 8004809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:01:29+00:00 2026-06-04T17:01:29+00:00

I have a trigger which executes after a record is inserted into a table.

  • 0

I have a trigger which executes after a record is inserted into a table. The trigger basically, calls a function and passes values from the insert into it. However, while it works some times, I also keep getting the following error:

Msg 8115, Level 16, State 2, Procedure UpdateNabersRating, Line 17
Arithmetic overflow error converting expression to data type int.

The trigger is as follows:

UPDATE BMS_Snapshot SET
    NABERS = dbo.SetmetricsNABERSCalculation(
        60,
        tbl.NetFloorArea,
        tbl.ElectricityCumulative,
        tbl.GasCumulative,
        tbl.ElectricityCumulativeMax,
        tbl.GasCumulativeMax,
        tbl.ElectricityMaxTotal,
        tbl.GasMaxTotal,
        tbl.NaturalGasConversionCubicMetersToMJ,
        tbl.SuburbId)
FROM
    (SELECT 
        Snap.SnapshotId AS SnapshotId,
        Snap.ElectricityCumulative AS ElectricityCumulative,
        Snap.GasCumulative AS GasCumulative,
        Building.NetFloorArea AS NetFloorArea, 
        Building.NABERSElecTotalMax AS ElectricityMaxTotal,
        Building.NABERSGasTotalMax AS GasMaxTotal,
        Building.NABERSExpiry As Expiry,
        NABERSTarget.ElecCumulativeMax AS ElectricityCumulativeMax,
        NABERSTarget.GasCumulativeMax AS GasCumulativeMax,
        [State].NaturalGasConversionCubicMetersToMJ AS NaturalGasConversionCubicMetersToMJ,
        Suburb.SuburbId AS SuburbId
     FROM inserted AS Snap 
        INNER JOIN AST_Building AS Building ON Snap.BuildingId = Building.BuildingId
        INNER JOIN ESD_Suburb AS Suburb ON Building.SuburbId = Suburb.SuburbId
        INNER JOIN ESD_State AS [State] ON Suburb.StateId = [State].StateId
        INNER JOIN AST_NABERSTarget NABERSTarget ON Snap.BuildingId = NABERSTarget.BuildingId AND
            Snap.TimeStamp = NABERSTarget.Timestamp
        /*Where Snap.SnapshotId IN (Select inserted.SnapshotId FROM inserted)*/) AS tbl
WHERE tbl.SnapshotId = BMS_Snapshot.SnapshotId AND BMS_Snapshot.Range = 1

I’ve been playing around with it for a while, but can’t seem to put my finger on the problem, particularly given it works sometimes.

  • 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-04T17:01:30+00:00Added an answer on June 4, 2026 at 5:01 pm

    Changed, arguments on function to FLOAT, instead of INT for two of the parameters.

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

Sidebar

Related Questions

I have a trigger which works after insert|update on one table(suppose table 1). The
I have to create the trigger(s) which will keep the audit of my table.
I have a TRIGGER for a MySQL table which raises exception with SIGNAL when
I have this trigger which works functionally (as far as I can tell by
I have within my Sql Server 2008 database a trigger which will run on
I have a stored procedure which is called inside a trigger on Insert/Update/Delete. The
I have a trigger that stores changes made in a separate table when a
I have a trigger to check for a single column in a table, when
I have below trigger ALTER TRIGGER [dbo].[DeleteUserData] ON [dbo].[site_users] AFTER DELETE AS BEGIN SET
I'm trying to write a table trigger which queries another table that is outside

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.