[Solved] I have a query with a between clause that is return wrong days [closed]

Let’s break this down: WHERE convert(varchar(10),F_Presence.ts, 120) between ‘2022-03-01’ and ‘2022-03-02’ Converting the column to a string means you will never, ever, ever be able to take advantage of an index on that column, whether it exists yet or not. Using BETWEEN is horrible for date ranges for multiple reasons. Using a format like YYYY-MM-DD … Read more

[Solved] CONCAT in stored procedure returns null

The documentation says CONCAT() returns NULL if any argument is NULL. This is demonstrated by this example: http://sqlfiddle.com/#!2/d41d8/47037 You can find some documentation on working with nulls here: http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html 2 solved CONCAT in stored procedure returns null

[Solved] C# DateTime not working for MSSQL stored procedure [closed]

Lets work backwards here – your stored proc will never work, you have not specified a field for the where, and it has 2 missing close parentheses. select * from MyTable where between CAST(@startDate AS VARCHAR(100) and CAST(@EndDateAS VARCHAR(100) should be select * from MyTable where SOMEFIELD between CAST(@startDate AS VARCHAR(100)) and CAST(@EndDateAS VARCHAR(100)) In … Read more