?
Solved

Date formatting - SQL to Excel

Posted on 2013-01-28
1
Medium Priority
?
427 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 18

Accepted Solution

by:
Jerry Miller earned 280 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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

762 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