If I try to run the query below, it never spits anything out. If I change the bolded part to include hardcoded datetimes instead of variables containing the same values as what was hardcoded, then it runs fine. I'm sure it's just a stupid mistake or incompetance about something on my part.. can anyone point out what? ;)
Changing the bolded part to
works fine and is very quick.
Here's some sample data I pulled up with this query:
StartTime...... ............... .....CashIn
2008-12-01 02:00:14.000 9.55
2008-12-01 02:12:58.000 80.41
2008-12-01 02:13:17.000 96.15
2008-12-01 02:13:20.000 76.25
2008-12-01 02:13:26.000 1279.60
Thanks all!!!
Code:
CREATE TABLE #TTemp (Date datetime, CashIn money) DECLARE @datetime datetime SET @datetime = '12/01/2008 02:00:00' INSERT INTO #TTemp (Date, CashIn) SELECT StartTime, CashIn FROM OrderDetail (nolock) WHERE IDType = 'P' AND [B]StartTime BETWEEN @datetime AND DATEADD(HOUR, 1, @datetime)[/B] SELECT * FROM #TTemp DROP TABLE #TTemp
Code:
StartTime BETWEEN '12/01/2008 02:00:00' AND '12/01/2008 03:00:00'
Here's some sample data I pulled up with this query:
Code:
SELECT TOP 5 StartTime, CashIn FROM OrderDetail WHERE IDType = 'P' AND StartTime BETWEEN '12/01/2008 02:00:00' AND '12/01/2008 03:00:00'
2008-12-01 02:00:14.000 9.55
2008-12-01 02:12:58.000 80.41
2008-12-01 02:13:17.000 96.15
2008-12-01 02:13:20.000 76.25
2008-12-01 02:13:26.000 1279.60
Thanks all!!!
Comment