I want to prompt the user to select dates from the existing dates of the OINV file. I have tried this but get an error:
DECLARE @FromDate datetime, @ToDate datetime
SET @FromDate = (SELECT Min(DocDate) FROM OINV WHERE DocDate = '[%0]')
SET @ToDate = (SELECT Min(DocDate) FROM OINV WHERE DocDate = '[%1]')
Any suggestions?