Forum Discussion

t-zhanqi's avatar
t-zhanqi
Microsoft Employee
6 years ago
Solved

SQL statement syntax error when using DATEADD()

I want to get the Monday of the CreatedDTim.

 

But i encountered an error while trying to connect.

 

 

 

  • t-zhanqi's avatar
    t-zhanqi
    6 years ago

    HI, v-easonf-msft  

    Thank you for your help. Your reply is of great help to me in solving this problem. I have solved this problem by using TIMESTAMPADD(). The reason I can't use DATEADD() is that my data source is ODBC instead of SQL SERVER. 

5 Replies

    • t-zhanqi's avatar
      t-zhanqi
      Microsoft Employee

      Thank you for your help. I have solved this problem by using TIMESTAMPADD(). The reason I can't use DATEADD() is that my data source is ODBC instead of SQL SERVER.

  • v-easonf-msft's avatar
    v-easonf-msft
    Community Support

    Hi , t-zhanqi 

    What kind of your database ?

    PowerBi has a variety of database connectors, if possible, it is recommended to use them directly rather than ODBC connectors.

    I try to  test your sql satement under the environment  of sql server, there is nothing wrong can be find.

    Can you run the statement normally in your database?

     

    Best Regards,
    Community Support Team _ Eason

     

     

    • t-zhanqi's avatar
      t-zhanqi
      Microsoft Employee

      HI, v-easonf-msft  

      Thank you for your help. Your reply is of great help to me in solving this problem. I have solved this problem by using TIMESTAMPADD(). The reason I can't use DATEADD() is that my data source is ODBC instead of SQL SERVER. 

      • v-easonf-msft's avatar
        v-easonf-msft
        Community Support

        Hi,  t-zhanqi 

        It's pleasant that you can share your sloution to us, people who meet a similar problem will be very happy with it.

        Please accept your reply as solution, so that other community members will easily find the solution when they get the same issue.

         

        Best Regards,
        Community Support Team _ Eason
        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.