I am trying to insert data from a staging table into original table for a particular time period in Microsoft SQL Server Management Studio 18 using below query.
INSERT INTO dbo.trial ([turbineid], [createddate], [lastupdatedby],[lastupdateddate])
SELECT
[turbineid], [createddate], [lastupdatedby], [lastupdateddate]
FROM
dbo.trial_January
WHERE
createddate BETWEEN (DATEPART(mm, createddate) = 01
AND DATEPART(dd, createddate) = 01))
AND (DATEPART(mm, createddate) = 01
AND DATEPART(dd, createddate) = 30)
When trying to execute this query, I get this error:
Incorrect syntax near '='.