我正在导出所有字段都是 varchar 字符串的 SQL 查询的结果。序列号等字段可能包含也可能不包含字母、建筑物编号和房间号,这些字段应保留其所有字符,以便在报告中使用。例如,序列号0129306201100910被截断为1.29306E+14,使其成为无用数据。这是我用来执行导出的实际编写的代码。关于如何修改它以保持前导零并停止科学记数法截断的任何建议?提前致谢。
wr.write("\"Inventory_No\",\"Building_No\",\"Actual_Building\",\"Room_No\",\"Actual_Room\",\"CDDEPT\",\"Location\",\"Actual_Location\",\"Normalized_MFG\""
+ ",\"Manufacturer\",\"Normalized_Model\",\"Model\",\"Serial Code\""
+ ",\"Cost\",\"Account_No\",\"Active\"");
wr.newLine();
int count = 0;
while (rs.next()) {
count += 1;
if (count % 1000 == 0) {
wr.flush();
response.flushBuffer();
}
wr.write("\"" + rs.getString("Inventory_No") + "\",");
wr.write("\"" + rs.getString("Building_No") + "\",");
wr.write("\"" + rs.getString("Actual_Building") + "\",");
wr.write("\"" + rs.getString("Room_No") + "\",");
wr.write("\"" + rs.getString("Actual_Room") + "\",");
wr.write("\"" + rs.getString("CDDEPT") + "\",");
wr.write("\"" + rs.getString("Location") + "\",");
wr.write("\"" + rs.getString("Actual_Location") + "\",");
wr.write("\"" + rs.getString("Normalized_MFG") + "\",");
wr.write("\"" + rs.getString("Manufacturer_Name") + "\",");
wr.write("\"" + rs.getString("Normalized_Model") + "\",");
wr.write("\"" + rs.getString("Name") + "\",");
wr.write("\"" + rs.getString("Serial_Code") + "\",");
wr.write("\"" + rs.getString("Cost") + "\",");
wr.write("\"" + rs.getString("Account_No") + "\",");
wr.write("\"" + rs.getString("Active") + "\",");
wr.newLine();
}