I have created a Temp table(#TempTable). I am trying to insert the date to get but I am getting an error. It's a dynamic query.
I am trying to get the date from another table and inserting the date to temp table
Just to make sure you understand the problem I have given an example
DECLARE @OfferEndDateTime datetime
SELECT @OfferEndDateTime = getdate()-1
print @VOfferEndDateTime
DECLARE @SQL VarChar(1000)
SELECT @SQL ='INSERT INTO #TempTable '+
'SELECT D,Points,@OfferEndDateTime '
exec(@sql)
Please Let me know where I am going wrong