Solved

The mystery of the missing SQL triggers

Posted on 2001-08-21
2
219 Views
Last Modified: 2012-05-04
Hello experts

I am bumbling along trying to customise a software product (Maximo) which is using SQL Server 7 as the back end.

Sadly I've not worked with SQL before and I've had no training so I'm feeling my way a bit.

Today a bizarre thing happened (well it seems bizarre to me anyway).

I had set up several SQL triggers against one of my tables, and they had been working very well. And then someone mentioned they seemed to have stopped working.

I went to have a look at them (using Enterprise manager, which is the only way I know of maintaining them) and they have all DISAPPEARED.

Assuming I don't have a saboteur around the place, and that I am not on drugs (you'll just have to take my word for it) how could this have happened?

Does SQL automatically "manage" them, and store them elsewhere sometimes? Or is this a known SQL bug?

(Come to think of it, several weeks ago I thought this had happened to one of my test databases, but I thought "Nah - it couldn't be - I must be mistaken". And since the DB wasn't important I thought no more of it. But now it seems I WASN'T mistaken. I think they disappeared then also).

Any ideas please? My chances of building a robust system seem pretty slim at the moment.

Thanks

Iain MacRae
0
Comment
Question by:MacRae
2 Comments
 
LVL 18

Accepted Solution

by:
nigelrivett earned 100 total points
ID: 6409052
Triggers shouldn't disappear for no reason.

Usually it is because you have recrated the table.
When you drop a table all the associated triggers are also dropped so need to be recreated afterwards.

The easiest way to do this is to include the trigger script in the same file as the table creation script.
0
 

Author Comment

by:MacRae
ID: 6411813
Thanks Nigel

That was indeed the answer.

I had run a Maximo function which "reconfigures" the database (in my case changed the length of some data items in a table), but I hadn't realised that would cause my triggers to be lost.

Oh well, at least I know what is happening now, and I can be prepared for it next time.

Thanks for your help.

Regards

Iain Macrae
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

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.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

911 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now