I want to select data of SourceTable from SourceDatabase and insert summarized SourceTable into TargetDatabase TargetTable automatically (maybe every 4 hours).
It seems ok to use code below to insert the table manually:
USE TargetDatabase
GO
INSERT INTO dbo.TargetTable(field1, field2, field3)
SELECT field1, field2, field3
FROM SourceDatabase.dbo.SourceTable
WHERE (some condition)
But I want every four hours run the query automatically. Is it possible?
You can use Jobs and schedule them as per your requirement