Solved

Tracing sql job

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

803 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