Solved

Tracing sql job

Posted on 2012-04-04
3
225 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how the fundamental information of how to create a table.

919 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

17 Experts available now in Live!

Get 1:1 Help Now