Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers. It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.
I've declared an @AsOf variable because I will eventually put this in a stored procedure and pass that value as a parameter. At the moment, it is set to NULL to select all of the records from vw_Cygnet_Tank_Readings_In
USE WHR_System_Tables DECLARE @AsOf as datetime2(7) SELECT @AsOf = NULL UPDATE tbl_Readings_Tanks SET tbl_Readings_Tanks.Inches_End = T.Inches , tbl_Readings_Tanks.Closing_Vol = (CTRI.Inches/12) * (3.14159 * (ET.Diameter/2) * (ET.Diameter/2)) * 0.17811 FROM ( SELECT ET.Equip_ID , CTRI.FacilityID , CTRI.DT_Recorded , CTRI.Product_ID , CTRI.TankNum , CTRI.Inches , ET.Diameter , Closing_Vol = (CTRI.Inches/12) * (3.14159 * (ET.Diameter/2) * (ET.Diameter/2)) * 0.17811 FROM dbo.vw_Equipment_Tanks as ET INNER JOIN dbo.vw_Cygnet_Tank_Readings_Inches as CTRI ON ET.DS_PK_Text = CTRI.FacilityID AND ET.Product_ID = CTRI.Product_ID AND ET.Tank_Num = CTRI.TankNum WHERE (@AsOf IS NULL) OR (CTRI.Dt_recorded > @AsOf) ) as T INNER JOIN tbl_Readings_Tanks as RT ON T.Equip_ID = RT.Equip_ID AND T.DT_Recorded = RT.docDate WHERE RT.Inches_End <> T.Inches
Join the community of 500,000 technology professionals and ask your questions.