Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert varchar date for link to Excel

Status
Not open for further replies.

stocktondesigns

Technical User
Aug 31, 2003
16
US
I am doing a query in Excel, the OrderDate is stored in SQL as a varchar field. When imported to Excel, it is seen only as Text, not a Date, and requires conversion in Excel. Surely there is a way to format my view/query so that this field's date comes into Excel as a Date format and not text. Would appreciate any assistance on this.
 
What is the format of the date in the varchar column? You should be able to CAST or CONVERT the varchar data to a datetime datatype in the SELECT query.

SELECT CAST(DateColumn AS datetime) AS DateColumn
FROM SQLTable

--John [rainbow]
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top