Solved

Date formatting - SQL to Excel

Posted on 2013-01-28
1
410 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My experience with Windows 10 over a one year period and suggestions for smooth operation
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

831 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