= CAST(GETDATE() AS date) filter in views .... BUG in management studio

Evan Camilleri 1 Reputation point
2021-08-24T09:37:34.717+00:00

If i enter this

= CAST(GETDATE() AS date)

as a filter on a date in the view designer, I get

Data type error in expression

BUT if i type it in the SQL script (of the same designer) it works OK

SQL Server | Other
{count} votes

2 answers

Sort by: Most helpful
  1. Viorel 122.6K Reputation points
    2021-08-24T11:14:33.767+00:00

    Try this filter:

    = { fn CURDATE() }


  2. AmeliaGu-MSFT 14,006 Reputation points Microsoft External Staff
    2021-08-25T07:00:49.473+00:00

    Hi EvanCamilleri-5895,

    Welcome to Microsoft Q&A.
    This issue happens to me. I’m not sure if it is a known issue or by design.
    I recommend you submit a feedback to this link: https://github.com/MicrosoftDocs/sql-docs/issues
    Your feedback is valuable for Microsoft to improve the level of products and service. Appreciate for your understanding.

    Best Regards,
    Amelia


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

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.