Modify TSQL script

Completed Posted 4 years ago Paid on delivery
Completed Paid on delivery

I setup SQL audit and dumping data into this location: O:\Audit\Data1. Now I need to load data into SQL table, AuditInfo. I need to run the following query in SQL job everyday.

The following script works fine. Modification needed, so when it runs every day, it will load only the previous day data into SQL table.

SELECT distinct *

FROM sys.fn_get_audit_file('O:\Audit\Data1\*.*', DEFAULT, DEFAULT)

INSERT INTO Test.[dbo].[AuditInfo] (

event_time

,action_id

,server_principal_name

,server_instance_name

,database_name

,schema_name

,object_name

,statement

)

SELECT event_time

,action_id

,server_principal_name

,server_instance_name

,database_name

,schema_name

,object_name

,statement

FROM sys.fn_get_audit_file('O:\Audit\Data1\*.*', DEFAULT, DEFAULT)

I need to modify this query, so the records that were inserted yesterday will be loaded into the SQL table

For example:

If I run the job 02/03/2020 at 9 pm the records on 02/02/2020 will be loaded

02/04/2020 at 9 pm the records on 02/03/2020 will be loaded

02/05/2020 at 9 pm the records on 02/04/2020 will be loaded

SQL MySQL Microsoft SQL Server PHP Software Architecture

Project ID: #23880342

About the project

5 proposals Remote project Active 4 years ago

Awarded to:

jeyhunilysov

Hi, there. I see that you need some help modifying SQL for your project. I can help with that and can start right away. I am senior web developer and have 5+ years of experience with Mysql. I am sure that I can do your More

$100 USD in 1 day
(11 Reviews)
4.8

5 freelancers are bidding on average $152 for this job

schoudhary1553

Hello, I can help you with your project - Modify TSQL script I have gone through your job posting and become very much interested to work with you. I am an expert in this field. I have already completed several proj More

$220 USD in 4 days
(124 Reviews)
7.2
aesthetichunzai

Hi I can provide you with solution based on your requirements i am experienced Database Admin with 13 years of exp with oracle and SQL Server

$100 USD in 3 days
(13 Reviews)
4.5
hantoyma

Hello, I have more of 10 years of experience working as a developer using Microsoft technologies, including sql server I have been providing SQL server support support to organization of all sizes, I have fixed and More

$200 USD in 7 days
(2 Reviews)
3.4
F2210655640

I have been engaged in software development for many years. I have extensive software development experience and can complete various software development tasks. My main skills are as follows Back-end technologies: C # More

$140 USD in 7 days
(0 Reviews)
0.0