Fix sql error when import unknowndevice. closes #2505