select distinct i.category, i.modelNbr from tbl_IMPORT_EquipmentStatus i left outer join tbl_OPR_AvailableEquipment ae on i.modelNbr = ae.modelNbr and i.ownerId = ae.ownerId and i.ownerType = ae.ownerType where i.eai_batchId = and i.ownerId = and i.ownerType = and ae.equipmentId is null and i.category is not null insert into tbl_OPR_AvailableEquipment ( ownerId, ownerType, modelNbr, modelName, category, programEquipment, obsolete, createDate, createUserId, updateDate, updateUserId ) values ( , , , , , , , {fn now()}, 0, {fn now()}, 0 ) select distinct ae.equipmentId, i.equipmentCode from tbl_IMPORT_EquipmentStatus i inner join tbl_OPR_AvailableEquipment ae on i.equipmentCode = ae.equipmentCode and i.ownerId = ae.ownerId and i.ownerType = ae.ownerType where i.eai_batchId = and i.ownerId = and i.ownerType = UPDATE tbl_IMPORT_EquipmentStatus set fseEquipmentId = , fseEquipmentIdStatus = '-' where equipmentCode = select distinct a.objectId as equipmentId, a.alias as equipmentCode from tbl_IMPORT_Aliases a inner join tbl_IMPORT_EquipmentStatus i on a.alias = i.equipmentCode and a.ownerId = i.ownerId and a.ownerType = i.ownerType and a.objectType = 'OperatorEquipment' where i.eai_batchId = and i.ownerId = and i.ownerType = UPDATE tbl_IMPORT_EquipmentStatus set fseEquipmentId = , fseEquipmentIdStatus = '-' where equipmentCode = select mdmId, operatorId from ( select mdmId, operatorId from tbl_OPR_ClientOperators where mdmType = 'CBS' and ownerId = and fsltablecode = ) x select distinct mdmId from tbl_IMPORT_EquipmentStatus where eai_batchId = and ownerId = and ownerType = UPDATE tbl_IMPORT_EquipmentStatus set fseOperatorId = where mdmId = and mdmType = and ownerId = and ownerType = and eai_batchId = UPDATE tbl_IMPORT_EquipmentStatus set fseOperatorIds = where mdmId = and mdmType = and ownerId = and ownerType = and eai_batchId = select i.eai_importId, i.eai_lineNumber, i.fseEquipmentStatusId, i.fseOperatorId, i.fseOperatorIds, i.fseEquipmentId, i.installationDate, i.retireDate, i.serialNumber, es.equipmentStatusId from tbl_IMPORT_EquipmentStatus i left outer join tbl_OPR_EquipmentStatus es on i.ownerId = es.ownerId and i.ownerType = es.ownerType and i.fseEquipmentId = es.equipmentId and i.serialNumber = es.serialNumber where i.eai_batchId = and i.ownerId = and i.ownerType = and i.fseEquipmentId is not null and ( i.fseOperatorId is not null or i.fseOperatorIds is not null ) select top 1 equipmentStatusId from tbl_OPR_EquipmentStatus where ownerId = and ownerType = and equipmentId = and operatorid = and serialNumber is null and status = 'PENDING' UPDATE tbl_IMPORT_EquipmentStatus set fseEquipmentStatusId = , fseEquipmentStatusIdStatus = 'U' where eai_batchId = and ownerId = and ownerType = and eai_lineNumber = and eai_importId = update tbl_OPR_EquipmentStatus set installationDate = , retireDate = , status = , updateDate = , serialNumber = where ownerId = and ownerType = and equipmentStatusId = INSERT INTO tbl_OPR_EquipmentStatus ( ownerId, ownerType, operatorId, equipmentId, serialNumber, status, installationDate, retireDate, updateDate, createDate, comment, createUserId, updateUserId ) VALUES ( , , , , , , , , , , , 0, 0 ) UPDATE tbl_IMPORT_EquipmentStatus set fseEquipmentStatusIdStatus = 'A', fseEquipmentStatusId = where eai_batchId = and ownerId = and ownerType = and eai_lineNumber = and eai_importId = and serialNumber = and fseEquipmentId = and fseOperatorId = #_addedEquipmentHTML#

Hello #htmlEditFormat(qmd_fseContactUser.firstname)# #htmlEditFormat(qmd_fseContactUser.lastname)#,

The following equipment has been added:

#_addedEquipmentHTML#
select mdmId, mdmType, '' reason, count(*) lineCount, min(eai_lineNumber) firstLine from tbl_IMPORT_EquipmentStatus where ( fseOperatorId IS NULL and fseOperatorIds IS NULL ) and eai_batchId = and ownerId = and ownerType = group by mdmId, mdmType order by firstLine asc select equipmentCode, count(*) lineCount, min(eai_lineNumber) firstLine from tbl_IMPORT_EquipmentStatus where fseEquipmentId IS NULL and eai_batchId = and ownerId = and ownerType = group by equipmentCode order by firstLine asc