How to pull the data before 11pm example for today's date: 2019-10-16 22:59:47.577 from a stored procedure which runs in the morning 5 am. Also it should exclude any data after 12 in the midnight .
tried cast(date <getdate()) function, it works fine if i run manually without putting in the stored procedure which run at 5 am, where data is the datecolumn in my table
I'm happy to provide more information if it doesn't make sense
October 16, 2019 at 11:28 am
You either have to add a filter into your stored procedure, or store the results of your stored procedure in a table, and then re-query that table.
October 16, 2019 at 11:34 am
what filter can i add in the stored procedure?
If you want today before 23:00, then it would be
datecolumn < dateadd(HOUR, 23, convert(datetime2(0), convert(date, sysdatetime())))
But you are talking about five o'clock in the morning, so maybe you really mean yesterday. In such case, replace 23 by -1.
[font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]
October 16, 2019 at 11:44 am
yes stored procedure run today but the data i need yesterday before 11pm and it works thank you
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply