question

EvanCamilleri-5895 avatar image
0 Votes"
EvanCamilleri-5895 asked AmeliaGu-msft answered

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

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-general
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can confirm, I get the error, too.
One of many reasons why I never use the designers in SSMS.

0 Votes 0 ·
Viorel-1 avatar image
0 Votes"
Viorel-1 answered ErlandSommarskog commented

Try this filter:

= { fn CURDATE() }

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


If I do a function I guess it would work BUT why it does not allow me I guess it's a bug which has been there for ages

0 Votes 0 ·

Bug? Rather a limitation. As Olaf says, stay away from the View Designer. It's crippled, and this is only one token of that.

0 Votes 0 ·
AmeliaGu-msft avatar image
0 Votes"
AmeliaGu-msft answered

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.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.