Skip to content
Advertisement

Records are not fetching date wise in SQL Server. 0 records found

I want to get the records from Dec-1-2019 to Dec-31-2019 but I am not getting any records from the database while checking with out date filter the records are coming. There are records in the database table between these days but not coming.

Query

Sample data

C# Code

Advertisement

Answer

Consider specifying an ISO 8601 datetime literal. That will be independent of the session DATEFORMAT setting and eliminate the need for CONVERT:

You might also consider specifying an inclusive start date and exclusive end date:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement