[dbo].[writeGasAnalysisRawXX] stored procedures
- Last UpdatedAug 07, 2025
- 13 minute read
These stored procedures are used to input gas quality data into the EFM database.
There is a different stored procedure for each granularity. They are as follows:
-
For hourly data, use the writeGasAnalysisHy stored procedure to input data into the database.
-
For daily data, use the writeGasAnalysisDy stored procedure to input data into the database.
-
For sampled data, use the writeGasAnalysisRawSa stored procedure to input data into the database.
Notes: Handling of irregular meter data is discussed in the section [dbo].[writeReadingRawIrr] stored procedure.
Raw data also will be copied into the rdm_ReadingAuditXX tables, where a copy of the unprocessed data will be kept for audit purposes. Any data that is incomplete or invalid will be moved to the rejected reading tables (sys_ReadingRejectedXX) for the user to evaluate. It is possible to view the already processed data in the Meter Summary from within the AVEVA Measurement Advisor client.
Internal Field (Parameter) Name
Field req'd?
Data Type (alias, SQL data type)
Description
@objName
Y
T_nameType, nvarchar(32)
@objName is the name of the gas quality. This value will be checked against the gasqualityName in the gasqualityDefine table. If the system has the CD_CONTACT module enabled and the @orgName is provided, the system will consider the @objName to be the externally known name and lookup the name internal to AVEVA Measurement Advisor. For example, organization 'Big Corp' calls our gas quality record '12345-01' by the name 'FHILLS01'. In this case, the orgName is 'Big Corp' and the objName is 'FHILLS01'. The system will use this to lookup that the internal name is '12345-01'. orgName will be compared to the column organizationName in the organizationDefine table. The objName will be checked against the aliasName column in the objectOrgAlias table for objects of type Gas Quality. If the @objName is not found, the gas quality data will be rejected.
@orgName
N
T_nameType, nvarchar(32)
orgName will be compared to the column organizationName in the organizationDefine table. If the @orgName is not found, the gas quality data will be rejected.
@localTime
N
T_nameType, nvarchar(32)
Either the @localTime or @time parameters must be provided. If both parameters are provided, the system will use the value of @time. This value should be consistent with the @timeFormat that is used.
@timeFormat
N
T_nameType, nvarchar(32)
A string to let the system know how to interpret the localTime string. The timeFormat is the format you have used for the localTime string. The default is '%m/%d/%Y %T'.
Additionally, the following timeFormats are also considered valid:
-
'2/22/2021 5AM', '%m/%d/%Y %I'
-
'22/2/01 17:00:00', '%d/%m/%y %T'
-
'2/22/21 17:32', '%m/%d/%y %R'
-
'21/02/22 7:32', '%y/%m/%d %R'
-
'21/02/22 7:32', '%Y/%m/%d %R'
@userName
Y
T_nameType, nvarchar(32)
The name of the user or system that is submitting the gas quality reading.
@editStateName
N
T_nameType, nvarchar(32)
Default is Observed
Options are:
-
Manual Override
-
Edited
-
Actualized
-
User Estimate
-
System Estimate
-
Observed
-
Observed Accepted
Provided value will be checked against the column editStateName in the editStateDesc table. If the edit state is not found, the gas quality data will be rejected.
@unitProfileName
N
T_nameType, nvarchar(32)
The default value is NULL. If a value is not provided, the system will retrieve the configured Input Unit Profile for the gas quality (inputProfileId from the gasQualityDefine table). If a value is provided, the value will be checked against the unitProfileName column in the unitProfileDefine table. If the unitProfileName is not found, the gas quality data will be rejected.
@dqInfoName
N
T_nameType, nvarchar(32)
The value will be checked against the column dqInfoName in the dqInfoDesc table. Options are as follows:
-
Null/None — No data quality information to report.
-
Clock Drift — Clock drift check failed.
-
Clock Sync — Clock sync check failed.
-
Invalid — Data source deems data invalid.
If the dqInfoName is not found, the gas quality data will be rejected.
@sampleNumber
N
T_gqSampleType, nvarchar(15)
A number associated with the sample. This is often the cylinder number or can also be another number to identify the sample.
Note: Only applicable for sampled gas qualities.
@reportNumber
N
T_gqSampleType, nvarchar(15)
A number usually associated with the lab that performed the analysis.
Note: Only applicable for sampled gas qualities.
@labCode
N
T_labCodeType, nvarchar(15)
A code to identify the lab that performed the compositional analysis of the fluid.
Note: Only applicable for sampled gas qualities.
@sampleTime
N
T_nameType, nvarchar(32)
The time the sample was collected. Uses the format specified by @timeFormat.
Note: Only applicable for sampled gas qualities.
@sampledBy
N
T_contactNameType, nvarchar(64)
The contact that took the sample. This will be a contact associated with the Sampling Organization defined on the gas quality configuration. If the contact is not found, the gas quality data will be rejected.
Note: Only applicable for sampled gas qualities.
@receivedTime
N
T_nameType, nvarchar(32)
The time the sample was received. Uses the format specified by @timeFormat.
Note: Only applicable for sampled gas qualities.
@receivedBy
N
T_contactNameType, nvarchar(64)
The contact that received the sample. This will be a contact associated with the Receiving Organization defined on the gas quality configuration. If the contact is not found, the gas quality data will be rejected.
Note: Only applicable for sampled gas qualities.
@analyzedTime
N
T_nameType, nvarchar(32)
The time when the sample was analyzed by the lab. Uses the format specified by @timeFormat.
Note: Only applicable for sampled gas qualities.
@analyzedBy
N
T_contactNameType, nvarchar(64)
The contact that performed the analysis of the fluid. This will be a contact associated with the Analyzing Organization defined on the gas quality configuration. If the contact is not found, the gas quality data will be rejected.
Note: Only applicable for sampled gas qualities.
@comment
N
T_messageType, nvarchar(255)
A short descriptive text that relates to the gas sample.
Note: Only applicable for sampled gas qualities.
@sampleType
N
T_nameType, nvarchar(32)
Text to describe the type of sample. For example, Spot, Composite.
Note: Only applicable for sampled gas qualities.
@gasLiquidRatio
N
T_doublePrecisionType, float
This is the gas-to-liquid ratio.
Note: Only applicable for sampled gas qualities.
@testGravity
N
T_doublePrecisionType, float
This is the test gravity value.
Note: Only applicable for sampled gas qualities.
@linePressure
N
T_doublePrecisionType, float
The pressure of the fluid in the pipeline at the point where the sample was taken.
Note: Only applicable for sampled gas qualities.
@samplePressure
N
T_doublePrecisionType, float
The recorded pressure of the sample cylinder after collection.
Note: Only applicable for sampled gas qualities.
@sampleTemperature
N
T_doublePrecisionType, float
The temperature at which the sample was collected.
Note: Only applicable for sampled gas qualities.
@heatingValue
N
T_doublePrecisionType, float
The amount of energy released in an ideal combustion reaction per unit of real gas volume. The units are defined by the Input Unit Profile of the gas quality record if a unit profile isn't included as part of the gas analysis.
This is the ideal heating value corrected by the compressibility.
@waterVaporFactor
N
T_doublePrecisionType, float
A correction factor to account for gas that is carrying water over a contractually defined limit (usually 7 lbs/MMCF for wet gas). How the factor is applied is dependent upon the delivery condition defined in the unit profile and whether the factor has been configured to be applied to the volume or heating value. If this is not specified, it will be calculated according to the Meter Properties.
@specificGravity
N
T_doublePrecisionType, float
The ratio of the mass density of the gas to the mass density of dry air calculated on a real basis. Also known as relative density.
This is the ideal specific gravity corrected by the compressibility.
@N2
N
T_doublePrecisionType, float
The amount of nitrogen in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile isn't included as part of the gas analysis. Typical units are mol fraction or mol %.
@CO2
N
T_doublePrecisionType, float
The amount of carbon dioxide in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile isn't included as part of the gas analysis. Typical units are mol fraction or mol %.
@H2
N
T_doublePrecisionType, float
The amount of hydrogen in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile isn't included as part of the gas analysis. Typical units are mol fraction or mol %.
@S2
N
T_doublePrecisionType, float
The amount of sulfur in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile isn't included as part of the gas analysis. Typical units are mol fraction or mol %.
@H2S
N
T_doublePrecisionType, float
The amount of hydrogen sulfide in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile isn't included as part of the gas analysis. Typical units are mol fraction or mol %.
@H2O
N
T_doublePrecisionType, float
The amount of water in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are lbs H2O/MMSCF or kg H2O/E6M3.
@waterVaporFactor
N
T_doublePrecisionType, float
A correction factor to account for gas that is carrying water over a contractually defined limit [usually 7 lbs/MMCF, for wet gas]. How the factor is applied is dependent upon the delivery condition defined in the unit profile and whether the factor has been configured to be applied to the volume or heating value. If this is not specified, it will be calculated according to the Meter Properties.
@He
N
T_doublePrecisionType, float
The amount of helium in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@O2
N
T_doublePrecisionType, float
The amount of oxygen in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@C1
N
T_doublePrecisionType, float
The amount of methane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@C2
N
T_doublePrecisionType, float
The amount of ethane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@C3
N
T_doublePrecisionType, float
The amount of propane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@nC4
N
T_doublePrecisionType, float
The amount of n-butane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@iC4
N
T_doublePrecisionType, float
The amount of isobutane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile isn't included as part of the gas analysis. Typical units are mol fraction or mol %. (this is also known as 2-methylpropane).
@nC5
N
T_doublePrecisionType, float
The amount of n-pentane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile isn't included as part of the gas analysis. Typical units are mol fraction or mol %.
@iC5
N
T_doublePrecisionType, float
The amount of isopentane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile isn't included as part of the gas analysis. Typical units are mol fraction or mol %. (This is also known as 2-methylbutane).
@C6
N
T_doublePrecisionType, float
The amount of hexane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile isn't included as part of the gas analysis. Typical units are mol fraction or mol %.
@C6plus
N
T_doublePrecisionType, float
The sum of the heavier hydrocarbons in the gas starting at the component defined by the Cx plus Type. For example, If CX plus is configured as C7, then C6plus is the sum of C7 through C10.
If @C6plus is not provided, the system will calculate it from the configured components. This value can also be spread to the higher components.
Note: Although this parameter is called C6 plus, it really holds the data for Cx plus, it has not been renamed to keep the API constant.
See Gas quality tab / Analysis component spreading / Spread Cplus enabled.
@C7
N
T_doublePrecisionType, float
The amount of n-heptane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@C8
N
T_doublePrecisionType, float
The amount of n-octane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@C9
N
T_doublePrecisionType, float
The amount of n-nonane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@C10
N
T_doublePrecisionType, float
The amount of n-decane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@dewpoint
N
T_doublePrecisionType, float
The temperature at a given pressure at which the water in the fluid will start to condense into liquid water.
@validate
N
T_booleanType, char(1)
Default is NULL (gets turned into a 'Y' if NULL). Options are:
-
NULL - System will perform validation on the record.
-
V - System will perform post calculation validation only.
-
Y - System will perform validation on the record.
-
N- System will skip validation on the record.
@isSummer
N
T_booleanType, char(1)
This is used when the system is interpreting the localTime when Daylight Saving Time (DST) ends and the datetimes during that transition are unclear. For example during the fall DST change in North America the 1-2AM time is repeated, this is used to specify which 1AM record it is. Options are:
-
NULL — Indicates an N
-
N — If there's a question about the time, the system will assume the winter timezone (not in DST)
-
Y — If there's a question about the time, the system will assume the summer timezone (in DST)
@runTime
N
T_doublePrecisionType, float
The total time between the start of the reading and the end of the reading. If the record is a split record, then the runtime is a portion of the period. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis.
Note: This is not applicable to sampled gas qualities.
@time
N
T_GMTtime, int
The time in seconds from Jan 1, 1970 in Greenwich Mean Time (GMT).
@offset
N
T_GMToffset, smallint
The timezone represented in minutes from GMT. For example, Mountain Standard timezone is -420. Mountain Daylight timezone is -360.
@CO
N
T_doublePrecisionType, float
The amount of carbon monoxide in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@Ar
N
T_doublePrecisionType, float
The amount of argon in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@neoC5
N
T_doublePrecisionType, float
The amount of neoPentane in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %. This is also known as 2,2-dimethylpropane.
@density
N
T_doublePrecisionType, float
This is the density value.
@viscosity
N
T_doublePrecisionType, float
This is the viscosity value.
@BSW
N
T_doublePrecisionType, float
The amount of base sediment and water in the liquid volume. Typically this only applies to crude oil. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typically this is reported as a percentage.
@cricondentherm
N
T_doublePrecisionType, float
The calculated cricondentherm temperature based on the composition of gas.
@totalSulphur
N
T_doublePrecisionType, float
The total amount of sulfur in the fluid. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis. Typical units are mol fraction or mol %.
@wobbeIndex
N
T_doublePrecisionType, float
The ideal-gas gross Wobbe Index.
This is the heating value / sqrt (specificGravity) at internal storage base conditions. Although it has the units of heating value, it is considered unitless.
@Zratio
N
T_doublePrecisionType, float
A dimensionless number that represents the compressibility factor of the gas at base conditions (Internal Storage) divided by the compressibility of the gas at flowing conditions (the base conditions of the unit profile specified in CD_ZRATIO_UNIT_PROFILE).
This is calculated by the system.
@HeatingValueIdeal
N
T_doublePrecisionType, float
The amount of energy released in an ideal combustion reaction per unit of ideal gas volume. The units are defined by the configured Input Unit Profile of the gas quality record if a unit profile is not included as part of the gas analysis.
@SpecificGravityIdeal
N
T_doublePrecisionType, float
The ratio of the mass density of the gas to the mass density of dry air calculated on a ideal basis. This is also known as the relative density.
@adjustmentCodeName
N
T_nameType, nvarchar(32)
If an adjustment is made to a previously submitted reading, the source system may choose to include a reason for the adjustment. This value maps to the column adjustmentCodeName in the table adjustmentCodes. If the code doesn't exist in the system, the reading will be sent to the rejected readings table with a reason of Invalid Adjustment Code Name.
-