Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12554

Using batch files - SQL Script which needs to be changed - automation question

$
0
0

Hi All,

I want to automate a 2 script process. Currently the 1st script loads a trace data to a table as:

USE DatabaseName

GO

--Change table name below

SELECT*INTO July_22_tablename

-- Change trc name below

FROM::fn_trace_gettable('Z:\TraceFilelocation\TraceName_22July2013.trc',default)

So I manually run the above script & change the tablename and the trace file name (1 day old trace file from location)

Then I run the 2nd script which reads data from the table:

select top 200

--Change table name below      

fromJuly_22_tablename 

I then use if for my reports. I am thinking of a better automation idea (batch files with sqlcmd/osql) but i am not sure how am i going to dynamically change the scripts, as seen above 1st script needs the right trc file name (2nd last oldest file from the location) and a new table name, 2nd script needs that new table name.

Thanks a lot!


D


Viewing all articles
Browse latest Browse all 12554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>