3

I have created a job with two steps:

  1. Delete 50000 rows from an error table older than 90 days.
  2. Create and email a quick report on the number of new records created in the error table that day, literally a:

    SELECT count_big(*) 
    FROM table
    WHERE datevalue < GETUTCDATE() 
    AND datevalue > DATEADD(DAY,-1,GETUTCDATE()) 
    

    ...but with some happy formatting to make an email table.

Currently I have step 2 running SQL in the job step rather than calling a stored procedure.

My question is, does it make a difference (performance or otherwise) in SQL Server 2014, to run a job step that calls a stored procedure or one that executes inline SQL?

Paul White
  • 83,961
  • 28
  • 402
  • 634
trocheaz
  • 157
  • 2
  • 7

1 Answers1

3

does it make a difference (performance or otherwise) in SQL Server 2014, to run a job step that calls a stored procedure or one that executes inline sql?

In your case, since you are just doing reporting, it won't make much difference either using inline SQL or a stored procedure.

Aaron Bertrand provides a really good answer to a related question:

Stored procedures vs. inline SQL

Kin Shah
  • 62,225
  • 6
  • 120
  • 236
  • I had read that post and was of a similar opinion but was unsure if the SQL Server Agent may have done something different under the covers that made stored procedures more effective or something. – trocheaz Apr 16 '15 at 12:58