Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Gerald30
Yak Posting Veteran
62 Posts |
Posted - 2012-03-07 : 19:06:47
|
| Hello All.Good morning.I just want to ask if it is possible to activate a trigger if there was an event from other table.Example.Table1 and Table2.If there is a new inserted data in table1 a trigger or stored proc in table2 will run to copy the inserted data in table1.I would like to run the stored proc or trigger from table2 because I don't want table1 to carry the additional process of dumping it's data to table2.I have already consider using Job Scheduler to run a stored proc but it will not be a real time.Please Help me if this one is possible.Thanks a lot. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-07 : 19:22:04
|
| you should be creating a trigger on table1 for that. I didnt understand what you meant by I don't want table1 to carry the additional process of dumping it's data to table2. In any case, trigger gets fired on event happening on table1 and it takes care of dumping process and will be fetching data from internal temporary table INSERTED which will have same structure as table1------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Gerald30
Yak Posting Veteran
62 Posts |
Posted - 2012-03-07 : 20:09:54
|
| Thanks visakh for the reply.What I really want to do is this, since in all the data entry is happening in table1 and so the there is a process that is going on. If the trigger will also be done on table1 there will be another process that will happen. But anyway I think i will just use a Job scheduler to run the stored proc.Thank you very much in your response. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-07 : 20:26:49
|
quote: Originally posted by Gerald30 Thanks visakh for the reply.What I really want to do is this, since in all the data entry is happening in table1 and so the there is a process that is going on. If the trigger will also be done on table1 there will be another process that will happen. But anyway I think i will just use a Job scheduler to run the stored proc.Thank you very much in your response.
still didnt understand why its a concern for youAnyways you can go with scheduler approach though it wont take place at real time.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|