Solved

Tracing sql job

Posted on 2012-04-04
3
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

628 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