Solved

sql date excel format

Posted on 2009-07-13
3
229 Views
Last Modified: 2012-05-07
Greetings,

When I run the following query, I export the results of the query to excel.

Problem here is that the date appears in Exel in the format of 2009-07-13

I would like the format to be 7/13/2009

We are using sql server 2005

Any help is appreciated

Sorry, I forgot to show you what I had tried:

SELECT     CONVERT(DATETIME, CONVERT(VARCHAR(20), eventDate, 102), 102))  
from myTable.

Open in new window

0
Comment
Question by:sammySeltzer
  • 2
3 Comments
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 50 total points
ID: 24840185
Date will be stored in the format 2009-07-13 in SQL Server.

If you want to view date in the format 7/13/2009, then this will do

SELECT CONVERT( varchar(10), CONVERT(datetime, '2009-07-13', 101), 101)
0
 
LVL 28

Author Comment

by:sammySeltzer
ID: 24840366
thanks a lot - it worked
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24840380
Welcome and glad to help you out.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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