Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
BBassic
Starting Member
10 Posts |
Posted - 2012-05-10 : 04:26:00
|
| Hi there,I'm trying to put together a stored procedure which pulls a list of orders placed on the current day but I can't figure it out.It needs to show all orders placed prior to executing the query but only for the current day. So if I used it at 2pm it'd need to show all orders placed between midnight and 2pmCan anyone point me in the right direction?Thanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-05-10 : 04:37:11
|
quote: It needs to show all orders placed prior to executing the query but only for the current day
SQL Server will not know when did you last execute that stored procedure. Unless in your stored procedure, you stored the last execution date and time somewhere everytime it is executed KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
BBassic
Starting Member
10 Posts |
Posted - 2012-05-10 : 04:39:43
|
quote: Originally posted by khtan
quote: It needs to show all orders placed prior to executing the query but only for the current day
SQL Server will not know when did you last execute that stored procedure. Unless in your stored procedure, you stored the last execution date and time somewhere everytime it is executed KH[spoiler]Time is always against us[/spoiler]
Thanks for that. My brain is saying that I could do something using the BETWEEN clause along with GETDATE but it isn't helping me out any further than that |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|