In SQL Server Management Studio, I am trying to reference a specific date and time, using a variable for the date, as shown below.
Declare @specified_date Date
set @specified_date = '07-01-2013'
Select *
from etc
Where CreatedDate > CONVERT(datetime, @specified_date & '00:00:00.000' )
This code is not working, and I am receiving this error:
The data types date and varchar are incompatible in the '&' operator.
The data being used has both a date and time code on it, and instead of changing multiple queries, I'd like to be able to just define the date once and have the variable carry it across. If anyone knows of a solution, that would be great.