Share via

About date type write error

太志 廣瀬 1 Reputation point
2021-05-13T03:41:59.24+00:00

Client : SQL Server Native Client 11.0
Server : SQL Server 2019

Date type data cannot be written.
But datetime2 type is OK.
Why?

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


2 answers

Sort by: Most helpful
  1. 太志 廣瀬 1 Reputation point
    2021-05-14T06:11:46.717+00:00

    Sorry, my information was wrong.

    Client ODBC System DSN driver : SQL Server
    Server : SQL Server 2019.

    Was this answer helpful?


  2. CathyJi-MSFT 22,431 Reputation points Microsoft External Staff
    2021-05-13T09:43:53.157+00:00

    Hi @太志 廣瀬 ,

    > Date type data cannot be written.

    Could you share us your script for analysis? What are the values of date that you want written?

    Default string literal format for date type is YYYY-MM-DD. Such as 2021-05-13

    Default string literal forma for datetime2 is YYYY-MM-DD hh:mm:ss[.fractional seconds]. Such as 2021-05-13 12:35:29.1234567

    Please refer to MS document date (Transact-SQL) and datetime2 (Transact-SQL).

    By the way, what is the error message that you got? Please also share us the error message.


    If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar queries.

    Was this answer helpful?

    0 comments No comments

Your answer

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