Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

DDL trigger

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mecn - 09 Jul 2008 14:28 GMT
Hi,

Is there something like sql2005 ddl triggers taht I could create in sql2000.
Basically, I need to have trigger on database level to trace for anyone who
change sql objects(table schema change, SP mpdification...)

Thanks,
Aaron Bertrand [SQL Server MVP] - 09 Jul 2008 14:36 GMT
In 2000 you could run a server-side trace that watches for specific DDL
events.  Or look into any number of 3rd party auditing products (which do
something similar for you).

OR, take away those privileges from users.  You should be able to control
who can make schema modifications in your systems, and establish a process
to document them, use source control, the whole works.  It's a little late
to just find out about the changes after the fact...

On 7/9/08 9:28 AM, in article OlwDsec4IHA.3368@TK2MSFTNGP04.phx.gbl, "Mecn"
<mecn@yahoo.com> wrote:

> Hi,
>
[quoted text clipped - 3 lines]
>
> Thanks,
vinu - 09 Jul 2008 14:40 GMT
Mecn

Simple answer is NO, sql 2k doesn't have DDL triggers.
You can create a trigger on sysobjects system table to tack changes. But
trigger on a system table is not recomended.

vinu

> Hi,
>
[quoted text clipped - 4 lines]
>
> Thanks,
Mecn - 09 Jul 2008 15:19 GMT
Thanks all.

> Mecn
>
[quoted text clipped - 12 lines]
>>
>> Thanks,
Aaron Bertrand [SQL Server MVP] - 09 Jul 2008 16:48 GMT
> You can create a trigger on sysobjects system table to tack changes. But
> trigger on a system table is not recomended.

Have you actually tried this?  What kind of workaround did you use?  I get
Msg 229, CREATE TRIGGER permission denied on object 'sysobjects'...

A
vinu - 09 Jul 2008 17:07 GMT
Aaron

Let me correct it, it sould not be sysobjects,  what i ment was syscolumns

to create a trigger on syscolumns, do this

On the  server setting tab( server property), click the 'Allow modification
to made directly to the system catalogs'

then on the database where you need to create the trigger, e.g let sy DBA
database, change the xtype column value sysobjects table to'U'

   update sysobjects set xtype='U' where id=3

now create the trigger

create             trigger testtr on dbo.syscolumns
for update
as

print 'test'

vinu

>> You can create a trigger on sysobjects system table to tack changes. But
>> trigger on a system table is not recomended.
[quoted text clipped - 3 lines]
>
> A
Aaron Bertrand [SQL Server MVP] - 09 Jul 2008 17:45 GMT
> Let me correct it, it sould not be sysobjects,  what i ment was syscolumns

OK, if that is the only type of change you are concerned about.

> On the  server setting tab( server property), click the 'Allow modification
> to made directly to the system catalogs'
[quoted text clipped - 11 lines]
>
> print 'test'

As you said, definitely not recommended.  Also consider the consequences of
applying a service pack, hotfix, or upgrading to SQL Server 2005 or beyond.
Mecn - 09 Jul 2008 18:31 GMT
Thanks all,

Last question, if I add update trigger on syscolumns table, trigger will
fire if SP modified?

Thanks

>> Let me correct it, it sould not be sysobjects,  what i ment was
>> syscolumns
[quoted text clipped - 22 lines]
> applying a service pack, hotfix, or upgrading to SQL Server 2005 or
> beyond.
vinu thomas - 09 Jul 2008 21:30 GMT
stored procedures are stored in SYSCOMMENTS table. Also Aaron has pointed out
why you should not do this.

> Thanks all,
>
[quoted text clipped - 29 lines]
> > applying a service pack, hotfix, or upgrading to SQL Server 2005 or
> > beyond.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.