Home > Blockchain >  Design SQL table to get data from different SQL query at regular intervals
Design SQL table to get data from different SQL query at regular intervals

Time:02-19

I ma trying to capture cpu usage of my current SQL server over a time period and came across a query from here

Please guide me how can i use the above query to insert the results in permanent table over collected period of time without overwriting timestamp values or duplicating entries?

Thanks

CodePudding user response:

You could use a scheduled job to execute the query and insert data into your table

https://docs.microsoft.com/en-us/sql/ssms/agent/schedule-a-job?view=sql-server-ver15

CodePudding user response:

If you use the syntax

INSERT INTO dbo.sysUseLig 
SELECT --the query

Having previously created your table dbo.sysUseLig with columns with the correct data types you will have what you need. There is a timestamp based column in the select.

  • Related