Synapse convert nvarchar to Date_ exclute the T00:00:00

rdboy_9727 61 Reputation points
2022-01-15T13:54:32.367+00:00

hi guys,
I don't want the part after the Time (T) in column event_day_date. How can I extract only the date.

Thanks.

165355-image.png

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,385 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ShaikMaheer-MSFT 38,551 Reputation points Microsoft Employee Moderator
    2022-01-17T11:13:38.777+00:00

    Hi @rdboy_9727 ,

    Thank you for posting query in Microsoft Q&A Platform.

    Use below query to get your desired output.
    SELECT FORMAT(TRY_CONVERT(DATE,'2021-12-09T00:00:00.0000000',102),'yyyy-MM-dd') as event_day

    165590-image.png

    Hope this will help. Please let us know if any further queries.

    ----------------

    Please consider hitting Accept Answer button. Accepted answers helps community as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.