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
 Transact-SQL (2005)
 SQL Date Format in Excel

Author  Topic 

JAdauto
Posting Yak Master

160 Posts

Posted - 2013-03-27 : 10:35:16
Im writing a SQL script that outputs DateTime data for a Date value, but when I output this to Excel, it will not "retain" the date format for the cell type. It just defaults to General cell type. The numerical data sets the cell type correctly. The string data sets the cell type correctly. But the Date for some reason will not retain Date format. Any ideas?
Thx

robvolk
Most Valuable Yak

15732 Posts

Posted - 2013-03-27 : 10:49:57
Excel is rather famous for mangling data formats. The only way to preserve it is to set the columns to Text before pasting data. If you're importing or using Text to Columns feature, you'd set the column type to Text on the last screen of the wizard.
Go to Top of Page
   

- Advertisement -