Current Position:Home > Writing result set to .csv file

Writing result set to .csv file

Update:11-30Source: network consolidation
Advertisement
All,
I am writing a result set(date and a message as a string)
if(rs!= null){
                date = new java.util.Date();
                String logDate = sdf.format(date);
                File log = new File(logDate+".csv");
                writer = new BufferedWriter(new FileWriter(log));
           // 5) Move to first record (and then next) record.
           while(rs.next())
              writer.write(rs.getString(1) + "," + rs.getString(2) + "\n");
                rowCount++;
           }Eaxmple:
1. 2008-03-31 error during
The problem is when I write this to a .csv file, when opened with excel, the date appears as
If I right click the column, and select format, I can format the date properly, but I don't want to do this.
Any suggestions?
M

The Best Answer

Advertisement
##### is what Excel usually displays when it can't display the entire cell contents in the width of the column. Try expanding the column in Excel and see if the date appears.
  • Writing result set to .csv file Update:11-30

    All, I am writing a result set(date and a message as a string) if(rs!= null){                 date = new java.util.Date();                 String logDate = sdf.format(date);                 File log = new File(logDate+".csv");                 wr

  • How to Compare 2 CSV file and store the result to 3rd csv file using PowerShell script? Update:10-11

    I want to do the below task using powershell script only. I have 2 csv files and I want to compare those two files and I want to store the comparision result to 3rd csv file. Please look at the follwingsnap: This image is csv file only.  Could you pl

  • How to call a SP with dynamic columns and output results into a .csv file via SSIS Update:10-11

    hi Folks, I have a challenging question here. I've created a SP called dbo.ResultsWithDynamicColumns and take one parameter of CONVERT(DATE,GETDATE()), the uniqueness of this SP is that the result does not have fixed columns as it's based on sales fr

  • Exporting query result set into CSV file using Forms Update:11-30

    Hi , My requirement is -> I need to create a form where I have a Multi line text box and two button. -> When I enter a query in text box and click on Execute button, It should execute a select query. -> After execution, Result set needs to be exp

  • Correlation Between several Different Arrays & Saving Results Into a.CSV file Update:10-11

    Hello Everyone! I have 3 arrays from which I initialize a .CSV file when I run my VI ( as you can see in the example file.)( I use data from other arrays as well but it is not important ) The First array "customer Number" can be from 0 - 15 The

  • Export query results to a CSV file Update:10-11

    Hi, My requirement is I need to export the results of a query to a CSV file. Can anyone please suggest a way to include the column names also in the CSV file? Thanks in advance. AnnieFollowing code is from asktom. I have modified to include column he

  • Select Query Results to a .csv file???? Update:11-30

    Hello All, I have a question in Oracle, if anyone knows how to do this. Please help me. How can I get the results of select query in Oracle loaded into a Excel file (.csv) file. Thanks in Advance, Sarada.Hi Sarada, as a csv is nothing more than a lis

  • Exporting query results into a csv file using arabic and hebrew chars Update:11-30

    Hi, iv'e encountered a problem, using plsql to export a query into a csv file.. the arabic turns into question mark. Do you have any idea why?Usually this indicates a mismatch between client and database character set. How do you export this query? W

  • Writing data from a CSV file in to table Update:11-30

    Hi All, I have a CSV (Comma Separated Values) file and i want to write its data in to the table. How can i get data from a CSV file.As Karthick suggested, you can use External Tables or Sql Loader functionality You can check this link for example on

  • Unable to save the webi report results in CSV file in XIR2 environment Update:10-11

    Hi Team,     We have one WebI report in BOXIR2 version and it fetching nearly 76+ records in the report. The report is running fine without any issues and when i am trying to export the results into CSV file we are getting the error msg (Maximum Bina