Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6946171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:31:49+00:00 2026-05-27T13:31:49+00:00

I am exporting results of an SQL query where all the fields are varchar

  • 0

I am exporting results of an SQL query where all the fields are varchar strings. Fields such as serial numbers which may or may not contain letters, building numbers, and room numbers that should retain all their characters in order to be of any use in the report. For example, Serial number 0129306201100910 gets truncated to 1.29306E+14 making it useless data. Here is the code I am using in order to do the actual writing of the export. Any suggestions on how to modify this in order to keep leading zeroes and stop the scientific notation truncation? Thanks in advance.

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();
                }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:31:50+00:00Added an answer on May 27, 2026 at 1:31 pm

    Make sure your csv writer formats the cell as “Text” which will write it as text disabling scientific notation.

    In case you double click on your cell you should be seeing the full value with your current code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script for exporting results of a mysql query as a csv
I need to export my query results from SQL Server 2008 to a CSV
I have this query where I am expecting a lot of results. private void
I am exporting a SQL Server table to a CSV using php (see code
I'm wondering why these two following conditions in SQL return different results First Condition
I have a table in SQL Server which looks like this: ID Code Name
Is there a way to compare a list of numbers to a SQL subquery
I am typing in SQL queries ( SELECT ...) in a software tool which
I would like to export a ad hoc Select query result sets from SQL
I have this line in my sql query: WHERE client = $id AND (isinvoiced

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.