Solved

Date formatting - SQL to Excel

Posted on 2013-01-28
1
383 Views
Last Modified: 2013-01-28
I have a field in SQL Server 2008 table that is a 'date' datatype.

I have an Excel 2010 spreadsheet that pulls inforation from a view that uses this field.

In SQL Server, the date is in the format: 'yyyy-mm-dd'.  

The view contains this converstion to attempt to get it in the format 'mm/dd/yyyy'.  

CONVERT (NVARCHAR(10), REPORTING_DATE, 101)

When refreshed, it is the mm/dd/yyyy format.  However, it is still a string.  It is not a date.

Any way for it to pull in as a date?

Thanks
0
Comment
Question by:mak345
1 Comment
 
LVL 18

Accepted Solution

by:
Jerry Miller earned 70 total points
ID: 38826900
You are converting it to a string using the NVARCHAR data type. Use something like this:

CONVERT (datetime, REPORTING_DATE, 101)

http://www.sqlusa.com/bestpractices/datetimeconversion/
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article will show you how to use shortcut menus in the Access run-time environment.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now