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
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 data import from excel spread sheet

Author  Topic 

kkmurthy
Starting Member

41 Posts

Posted - 2010-03-16 : 14:32:02
I am importing data from excel file to the database table. I am creating the table by default.I have fields in excel file which gives just the time values such as 12:47, 16:15 etc. I am using import wizard in SQL server Management studio. The data gets transferred successfully. The only problem I have is all the time values are saved as 12/30/1899 12:47 instead of just 12:47. The correspoding field in the db table is datetime.

Can some one help me resolve this.

namman
Constraint Violating Yak Guru

285 Posts

Posted - 2010-03-16 : 14:57:31
Because the data type is datetime. If you use 2008, you can select data type as time, then the problem is solved. If you still want to use 2005, use varchar data type for the columns. Limitation of this is that if later you want to search the table by those columns, you have to convert values from varchar to datatime. This clearly impact on performance.
Go to Top of Page

kkmurthy
Starting Member

41 Posts

Posted - 2010-03-16 : 15:26:03
Thank you for the response. Initially I did not want to convert this to varchar. This is because I am mgoping to use these time values for calculations. But now I will try this and see how it works.
thank you again.
Go to Top of Page
   

- Advertisement -