Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Query

Posted on 2013-11-14
6
Medium Priority
?
168 Views
Last Modified: 2013-12-13
Hi,

I need to know who updated the SProc and SQL Job last month.
Thanks
0
Comment
Question by:SanPrg
[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
  • 3
  • 2
6 Comments
 
LVL 12

Expert Comment

by:Tony303
ID: 39650035
For the SProc question.


In SSMS, right click on DB (or Server), choose Reports / Standard Reports / Schema Changes History.

Hopefully the data goes back far enough to last month.

T
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 39650299
Hi SanPrg

Finding the list of Stored Procedures modified and created for last x days is also possible using sql query
-- Stored Procedures MODIFIED within 7 days 
SELECT name
 FROM sys.objects
 WHERE type = 'P'
 AND DATEDIFF(D,modify_date, GETDATE()) < 7

-- Stored Procedures CREATED within 7 days 
SELECT name
 FROM sys.objects
 WHERE type = 'P'
 AND DATEDIFF(D,create_date, GETDATE()) < 7

Open in new window


Raj
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 39650305
To get the list of Jobs modified in last 100 days, use the below query

select s.name,l.name, s.date_created, s.date_modified
 from  msdb..sysjobs s 
 left join master.sys.syslogins l on s.owner_sid = l.sid
 where DATEDIFF(D, s.date_modified, GETDATE()) < 100

Open in new window


Raj
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

Author Comment

by:SanPrg
ID: 39650339
Hi Raj,
So far it's good but I need to know who modified SProc and Jobs.
0
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 2000 total points
ID: 39650471
Hi

For Jobs, not sure this is the modified user
select s.name,l.name user_modified, s.date_modified
 from  msdb..sysjobs s 
 left join master.sys.syslogins l on s.owner_sid = l.sid
 where DATEDIFF(D, s.date_modified, GETDATE()) < 100

Open in new window

0
 

Author Closing Comment

by:SanPrg
ID: 39718208
Thanks
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
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.
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.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

660 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