Link to home
Start Free TrialLog in
Avatar of mak345
mak345Flag for United States of America

asked on

Formatting Dates in Excel through SQL Connection

I have an excel spreadsheet with a column formatted in mm/dd/yy format.
I set up a connection to pull this date in from a view in a SQL server database.  However, when it pulls in, it appears in the format yyyy-mm-dd.  It ignores the formatting of the spreadsheet.   If I adjust the view to using a CAST function to format the date the way I want, it works.  But I was wondering if there was any other way this can work without using CAST?

In the original table, the field where date is being pulled from is of datatype 'date'.  

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
btw if this is on SQL 2012 you have available the new FORMAT() function
SELECTFORMAT(YourDateColumn, 'mm/dd/yyyy')
Avatar of mak345

ASKER

Thanks.
Thanks for the grade.  Good luck with your project.  -Jim