Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
» Sitemap
Free Newsletters:

By submitting your information, you agree that databasejournal.com may send you databasejournal offers via email, phone and text message, as well as email offers about other products and services that databasejournal believes may be of interest to you. databasejournal will process your information in accordance with the Quinstreet Privacy Policy.

News Via RSS Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted Oct 3, 2000

What's Changed?

By Alan Enderby

Someone fobbing you off saying nothing has changed ?

This script displays the most recent object changes in the last nnn days.

Example sp_objects 10
Will show any objects that have been (dropped and) created in the last
10 days.

use master
if exists (select * from sysobjects where id =
object_id('dbo.sp_objects') and sysstat & 0xf = 4)
drop procedure dbo.sp_objects

/****** Object: Stored Procedure dbo.sq_objects Script Date:
04-Mar-98 1:46:20 PM ******/
create proc sp_objects @days int=9999 as
declare @msg varchar(255)
select @msg=upper(db_name()) + ' objects changed in the last ' +
convert(varchar(30),@days) + ' days'
print @msg
select @msg=replicate('=',datalength(@msg))
print @msg
print ' '
select Name=name,
when type='C' then 'CHECK constraint' when type='D' then 'Default
or DEFAULT constraint' when type='F' then 'FOREIGN KEY constraint'
when type='K' then 'PRIMARY KEY or UNIQUE constraint' when
type='L' then 'Log' when type='P' then 'Stored procedure' when
type='R' then 'Rule' when type='RF' then 'Stored procedure for
replication' when type='S' then 'System table' when type='TR' then
'Trigger' when type='U' then 'User table' when type='V' then
'View' else type
from sysobjects
where datediff(dd,crdate,getdate()) < @days
order by crdate desc
print ' '

MS SQL Archives

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM