Solved

Question for vujos

Posted on 2000-04-07
2
243 Views
Last Modified: 2012-05-04
Regarding triggers on system tables, my experience has been as simonsabin says.  I created it but it never fired regardless how i tried.
Please  provide me with the explanation how to create it and have it execute.
0
Comment
Question by:xoxomos
2 Comments
 
LVL 1

Accepted Solution

by:
vujos earned 50 total points
ID: 2697150
Hi,

Following is tested on MSSQL 6.5 (did not have time yet to try on 7.0).

But let's start :

1)<enable update on system tables>

sp_configure 'allow update', 1
reconfigure with override

2)<make syslogins table visible in EM>

update sysobjects set sysstat = 99 where name = 'syslogins' and id = 33

3)<add custom message>

sp_addmessage 50009, 16, 'This is my test message'

4)<create trigger for add, upd of login>

CREATE TRIGGER reminder ON syslogins
FOR INSERT, UPDATE AS RAISERROR (50009, 16, 10)
GO

3)<make syslogins invisible in EM>

update sysobjects set sysstat = 113 where name = 'syslogins' and id = 33

4)<disable system tables updates>

sp_configure 'allow update', 0
reconfigure with override

5)<try to add new login from EM or run>

sp_addlogin 'test1', 'testing', 'master', default


Well there you go, you still think that this was easy ?

General comment is still walid : any playing with system tables should be avoided. If you have to, please backup all the databases (you could end up rebuilding your master db - you know what that is). Please do not try above on production system. This is only an demo.

Hope this helps.

0
 

Author Comment

by:xoxomos
ID: 2700889
O.K.  i'll try that and keep in mind not to do it on a production system ---- just yet.  I'm using 6.5 anyhow.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how the fundamental information of how to create a table.

785 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