Quantcast
Channel: CodeSection,代码区,SQL Server(mssql)数据库 技术分享 - CodeSec
Viewing all articles
Browse latest Browse all 3160

Format Date Column in Excel From SQL Server Export File

$
0
0
Format Date Column in Excel From SQL Server ExportFile Posted: August 3, 2016 | Author: Jingyang Li | Filed under: Uncategorized | Leave a comment

When I export data to an Excel file from SSMS, the datetime column becomes a text format yyyy-mm-dd 00:00:00, for example: “2016-06-30 00:00:00”.

When you highlight the column to format the cell to date, it will not work.

A work around solution is:

Step 1: Highlight the column in question and Click on Data Tab>>Text to Columns >>with Delimited selected (default) click Next>> keep default Delimiters (Tab) >> click Next >> Column data format ― choose Date in the format YMD and click Finish. The datetime values in the column become m/d/yyyy 0.00 format in excel now, for example: “6/30/2016 0.00”.

At this point, you can use Excel format cells function to format the data to the format you want. Highlight the column>> right click>> Format cells>> under Number tab ― choose > Date … Choose from the Type: list. I choose m/dd/yyyy for my date column for now. >> click OK and save your excel file.


Viewing all articles
Browse latest Browse all 3160

Trending Articles