Unresolved reference to object error then trying to use DATE_BUCKET function
Borisov, Maksim
0
Reputation points
Hi, I'm using VS 2022 SQL server database project with target platform to SQL server 2022 (Compatibility mode 160). I tried to use new DATE_BUCKET function in the view:
CREATE VIEW dbo.Weeks
AS
SELECT DATE_BUCKET(WEEK, 1, GETDATE()) AS WeekStart
But got the error:
Error: SQL71005: The reference to the column WEEK could not be resolved.
The same code works fine in the MSS Management studio. I'm sure that I selected correct Compatibility mode for the project, because I can use also new GENERATE_SERIES function without errors.
Please, help me how to solve it or maybe I something missing?
Sign in to answer