Solved

The mystery of the missing SQL triggers

Posted on 2001-08-21
2
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
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 date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

729 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