Solved

sql date excel format

Posted on 2009-07-13
3
207 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 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

10 Experts available now in Live!

Get 1:1 Help Now