Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

How to convert a datetime field to a date field in SQL

$
0
0

Hi,

I embedded a SQL query in excel that gets some datetime fields like "TASK_FINISH_DATE" .

How can I convert a datetime field to a date field in SQL in a way that excel will recognize it as a date type and not a text type?

I tried:

CONVERT(varchar(8),TASK_FINISH_DATE ,3)

CONVERT(Date,TASK_FINISH_DATE ,3)

CAST(TASK_FINISH_DATE as date)

**all of the above returned text objectes in excel and not date objects.

Thanks!


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>