Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Date formatting - SQL to Excel

Posted on 2013-01-28
1
Medium Priority
?
434 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

618 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