I am having an issue with the most simple command in SQL Server Management. It seems the issue with is in the converting process. The current column is set to date only but I need to be able to specify the range under date and time. I would ultimately like to query where datetime is greater than the previous days datetime.
Can anyone lend me a hand on this one? I am pulling may hair out on the most simple query.
Select
FROM [CustomerTracking].[dbo].[Submission]
WHERE
Date(CONVERT(Datetime, '0000-00-00 00:00:00', 102))
is BETWEEN '2012-03-14 12:23:00' AND 'Now'
GO
SELECT * FROM [Submission]
WHERE CONVERT(DATETIME,[DateOnlyColName])
BETWEEN CONVERT(DATETIME,'01/01/2012 12:15:00') AND GETDATE()
You probably want something like this:
Select *
From [CustomerTracking].[dbo].[Submission]
Where Convert(Datetime, [YOUR_DATE_COLUMN], 102) Between '2012-03-14 12:23:00'
AND Getdate()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With