Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 write trigger when sp changes

Author  Topic 

rajusvs
Starting Member

9 Posts

Posted - 2001-12-18 : 12:50:57
Hi

I would like to write a trigger, if there is any change in stored procedures, help send some help, code related to this,


Thanks


AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2001-12-18 : 15:35:32
To accomplish this, I believe you would have to write a trigger on a system table like sysobjects. I would discourage this idea. However, a possible workaround would be something like this:

1) Create a baseline of data:
INSERT INTO SprocBaseline SELECT id, name, crdate, version FROM sysobjects where type = 'P'

2) Create a scheduled job to run periodically to do this:
SELECT name, crdate, version FROM sysobjects t1 LEFT OUTER JOIN SprocBaseline t2 on t1.id = t2.id where t1.type = 'P' and (t2.crdate <> t1.crdate OR t2.version <> t1.version)

You'll probably want to put the results of the job in another table, for later review.

-------------------
It's a SQL thing...
Go to Top of Page
   

- Advertisement -