If a meter is enrolled under one site (Site A) but does not show up in the Site A meter drop down list. Instead, the meter shows up under the Site B drop down list and will not display and information in the reports.
Take the meter serial number from the problem meter and insert it into the following queries:
select * from meter where serialnumber = ‘xxxxxxx’;
select * from site;
select * from pam_xdata where meteridfk in (select id from meter where serialnumber = ‘xxxxxxx’) order by xaction;
Compare the SITEIDFK field from the METER table to the site name in the SITE table. If the METER SITEIDFK is the wrong one then check
the PAM_XDATA table for the SITEIDFK. If PAM_XDATA has the right site ID then you will only need to update the meters site ID. Changing
the meters site ID to match the correct site and the site ID in PAM_XDATA will allow the reports to work.
Essentially what you need to run is:
UPDATE METER SET SITEIDFK=XXXXXXX WHERE ID=YYYYYYY AND SERIALNUMBER=ZZZZZZZZ;
If you can figure out the numbers for XXXXXXX and YYYYYYY you probably know ZZZZZZZZ. In fact it's not necessary to put both YYYYYYY and ZZZZZZZZ in the WHERE clause but this helps make sure you don't accidentally update the wrong meter. So:
1. Find the #s by getting the IDs in the METER and SITE tables.
2. Run the UPDATE. Use SQL Developer or SQL Tools so you can verify that only 1 row was updated.
3. Query back the METER table to make sure that the meter you wanted to update got updated.
4. COMMIT the change.
UPDATED: March 24, 2017