Always read the error message - Syntax Error, permission violation, or nonspecific Reviews another error
There is either:
An error in the sql - you can check this by running the sql in isolation.
A permission issue - harder to track, I would test this by creating a simple SSIS package and try to run it from your code.
Non specific error - eliminate the first two possibilities then look into this.
“That which can be asserted without evidence, can be dismissed without evidence.”
What's the version / localization of your SQL Server?
I tried it with SQL Server 10.0.5500, German localized Management studio. I adjusted the date format of your query, and tested it. And it worked as it was expected to work - I cannot reproduce your bug.
Last Visit: 31-Dec-99 18:00 Last Update: 24-Sep-23 5:08