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 an Excel file with a field needs format

Author  Topic 

wsilage
Yak Posting Veteran

82 Posts

Posted - 2014-07-23 : 14:20:41
I am import a file from Excel that has dates as this type 10:00 AM. When I import it into SQL, the field looks like this....

1899-12-30 10:00:00.000

How can I import this field to stay like 10:00 AM?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-07-23 : 14:24:34
Can you use the time data type instead of datetime? What version of SQL Server are you using? The format of the time portion won't change, but you won't get the date in there too. If you need a special format to be displayed, you can do that in the front-end of via the appropriate style using the CONVERT function. The storage of the date/time data cannot be changed and isn't actually what you are seeing anyway. What can be changed is the display of it.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -