Fix sql errors on network inventory. closes #2256