When i save the query analyser output to Excel, it always messes up the
display for datetime columns ? Why is that ? and how can i copy and paste
without do all the conversions,etc. ? Right now to show the actual datetime
in excel, i have to format the cells to text and then paste again..Hassan,
Unfortunately, you have to create an Excel-understood string
yourself. Here's an example of how you would do it with the
OrderDate column in Northwind's Orders table:
select
convert(varchar(30),OrderDate, 101)
+ space(1)
+ convert(varchar(30),OrderDate, 8)
from Northwind..Orders
This is for the US local month/day/year. If you need day/month/year
instead, use format 103 instead of 101. It's worth testing this a bit,
since quite a few factors can influence how dates are interpreted.
Steve Kass
Drew University
Hassan wrote:
>When i save the query analyser output to Excel, it always messes up the
>display for datetime columns ? Why is that ? and how can i copy and paste
>without do all the conversions,etc. ? Right now to show the actual datetime
>in excel, i have to format the cells to text and then paste again..
>
>
>|||Don't copy/paste. Instead, from the menu options, choose the output to be
Text, Comma Delimited instead of Grid, Column Aligned. Then save the output
as csv or just copy and paste this into Excel, which can handle this format
better than the fixed-width, Column Aligned format.
Sincerely,
Anthony Thomas
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:e67sHppIFHA.2744@.tk2msftngp13.phx.gbl...
When i save the query analyser output to Excel, it always messes up the
display for datetime columns ? Why is that ? and how can i copy and paste
without do all the conversions,etc. ? Right now to show the actual datetime
in excel, i have to format the cells to text and then paste again..
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment