Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Importing issue

Author  Topic 

aakcse
Aged Yak Warrior

570 Posts

Posted - 2010-01-22 : 02:46:41
Hi all,

I have imported a tabel from sql 2005 to excel 2007, I am getting dates for some columns as '1/2/1900 12:00:00 AM'

However when I do a select in sql it gives me
'1900-01-01 00:00:00.000' which is right,

why the date is getting changed in excel for only some columns, and the datatype for those columns is date only.

Regards,
aak

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2010-01-22 : 02:57:31
Madhi is probably able to give you a better advice on this one (he's the excel whiz among us) but what I do is to convert the datetime columns to varchar in the correct format first sort of like this:

SELECT Something, MyDateColumn AS CONVERT(varchar(25), MyDateColumn, 120)

- Lumbago
http://xkcd.com/327/
Go to Top of Page

aakcse
Aged Yak Warrior

570 Posts

Posted - 2010-01-22 : 04:18:50
Thanks Lumbago,

I'll put this question in excel forum.
Go to Top of Page
   

- Advertisement -