I am running the following SQL in SEDE (StackExchange Data Explorer).
This SQL can specify the date and time for CreationDate, and the default value uses the value of @MonthsAgo variable.
This works fine if you enter a date and time, but you get the following error with the @MonthsAgo variable:
Conversion failed when converting date and/or time from character string.
https://data.stackexchange.com/stackoverflow/revision/1187086/1459772
declare @MonthsAgo date = cast(dateadd(month, -2, getdate()) as date)
declare @since date = ##SinceDate:string?@MonthsAgo##
select vote.PostId, post.Score, post.CreationDate from votes vote
inner join posts post on post.Id = vote.PostId
where post.CreationDate >= @since and Tags like '%java%'
order by post.Score desc
How can I search using this variable?