Sql Query Results to CSV format doesn't include the correct date values

Sike12

Following is my query

Following is my table structure

Table Name: Person

      ID:  (PK,int, not null)
      Name: (Nvarchar(20),null)
      BirthDate : (Datetime,null)

Following is my query

      select Name,BirthDate From Person

Output is as follows

      Name   BirthDate
      Sam    1986-01-01
      Bob    2001-04-07
      John   2000-02-02

Output in CSV

      Name   BirthDate
      Sam    00:00.0
      Bob    00:00.0
      John   00:00.0

In order to export this content to csv all i do is select the values and right click on the output window with "copy with headers" option. it creates the CSV fine but when i open the file i get BirthDate as 00:00.0 for all three values. I don't understand what's causing this. Please help.

AnalystCave.com

Change the output to:

Name;BirthDate
Sam;"1986-01-01"
Bob;"2001-04-07"
John;"2000-02-02"

This way in Excel the dates will show normally (I added ";" as sep but of course this can be tab or anything else).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to output MySQL query results in CSV format?

From Dev

MyBatis RowBounds doesn't limit query results

From Dev

Query Not Returning Correct Results -- Sql Server Xquery

From Dev

Correct format of sql query in java

From Dev

IsPrimitive doesn't include nullable primitive values

From Dev

MYSQL between doesn't include max date

From Dev

php sql query not returning correct results

From Dev

MYSQL: Query data between two dates using date_format doesn't work

From Dev

SQL parameterized query not returning correct results

From Dev

MomentJS doesn't return correct date with HandlebarsJS

From Dev

Perl, SQL query and save data to csv file with correct Datetime format

From Dev

Image click creates a specific php query but doesn't return correct results

From Dev

TryParseExact doesn't work on string with date and time while format include only date format

From Dev

SQL query: HAVING date = MAX(date) doesn't work

From Dev

Correct format of #include directive

From Dev

PHP - nested recursive SQL query doesn't retrieve values

From Dev

sql 'str_to_date' function error truncated incorrect date value and doesn't show the right time format

From Dev

SQL Error on date, whats the correct format to upload seperate date and time?

From Dev

SQL query doesn't give any results in PHP

From Dev

IsPrimitive doesn't include nullable primitive values

From Dev

php sql query not returning correct results

From Dev

sql query not returning correct results

From Dev

MomentJS doesn't return correct date with HandlebarsJS

From Dev

AngularJS format date doesn't format

From Dev

Powershell - amend date format to values in CSV column

From Dev

Format date of filters and results on SQL Server

From Dev

date() which echo's correct date and time format, but doesn't store it correctly in database

From Dev

Convert date format doesn't take effect on self made date string in SQL Server

From Dev

SQL developer query results to dynamic csv file

Related Related

  1. 1

    How to output MySQL query results in CSV format?

  2. 2

    MyBatis RowBounds doesn't limit query results

  3. 3

    Query Not Returning Correct Results -- Sql Server Xquery

  4. 4

    Correct format of sql query in java

  5. 5

    IsPrimitive doesn't include nullable primitive values

  6. 6

    MYSQL between doesn't include max date

  7. 7

    php sql query not returning correct results

  8. 8

    MYSQL: Query data between two dates using date_format doesn't work

  9. 9

    SQL parameterized query not returning correct results

  10. 10

    MomentJS doesn't return correct date with HandlebarsJS

  11. 11

    Perl, SQL query and save data to csv file with correct Datetime format

  12. 12

    Image click creates a specific php query but doesn't return correct results

  13. 13

    TryParseExact doesn't work on string with date and time while format include only date format

  14. 14

    SQL query: HAVING date = MAX(date) doesn't work

  15. 15

    Correct format of #include directive

  16. 16

    PHP - nested recursive SQL query doesn't retrieve values

  17. 17

    sql 'str_to_date' function error truncated incorrect date value and doesn't show the right time format

  18. 18

    SQL Error on date, whats the correct format to upload seperate date and time?

  19. 19

    SQL query doesn't give any results in PHP

  20. 20

    IsPrimitive doesn't include nullable primitive values

  21. 21

    php sql query not returning correct results

  22. 22

    sql query not returning correct results

  23. 23

    MomentJS doesn't return correct date with HandlebarsJS

  24. 24

    AngularJS format date doesn't format

  25. 25

    Powershell - amend date format to values in CSV column

  26. 26

    Format date of filters and results on SQL Server

  27. 27

    date() which echo's correct date and time format, but doesn't store it correctly in database

  28. 28

    Convert date format doesn't take effect on self made date string in SQL Server

  29. 29

    SQL developer query results to dynamic csv file

HotTag

Archive