Solved

The mystery of the missing SQL triggers

Posted on 2001-08-21
2
220 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Live Storage Vmotion VMs with shared VMDK 10 57
Simple SQL query from two tables 13 54
Querying data from 3 SQL tables 2 31
Update a text value in another table 10 39
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

776 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