Solved

Tracing sql job

Posted on 2012-04-04
3
214 Views
Last Modified: 2012-04-04
I have scheduled a job that has a delete strategy based on a time-stamp column. It is working fine.

But, I would like to know how many rows were affected/deleted in a single run. Is it possible to trace??

I see the duration was 00:00:00 but it doesn't mean that no rows were affected...
0
Comment
Question by:w3brang3r
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Anuj earned 300 total points
ID: 37806500
As per my knowledge by default we don't have that option, but you can use @@ROWCOUNT and insert the results to a new table, this method is just like logging.

E.g

DECLARE @Count INT

DELETE FROM myTable Where MyColumn>getdate()

SET @count = @@ROWCOUNT

-- Insert into log table
INSERT INTO LogMyTableDelete(JobRunTime, @count)
SELECT  GETDATE(),@Count
0
 

Author Comment

by:w3brang3r
ID: 37806803
But I'm trying to trace a job that ran last night.
0
 
LVL 15

Expert Comment

by:Anuj
ID: 37806905
Sorry, There is no way unless you have any audit or dml trigger on the tale.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now