SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Event Trigger
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Gerald30
Starting Member

Philippines
46 Posts

Posted - 03/07/2012 :  19:06:47  Show Profile  Reply with Quote
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

India
48061 Posts

Posted - 03/07/2012 :  19:22:04  Show Profile  Reply with Quote
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 MVP
http://visakhm.blogspot.com/

Go to Top of Page

Gerald30
Starting Member

Philippines
46 Posts

Posted - 03/07/2012 :  20:09:54  Show Profile  Reply with Quote
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.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
48061 Posts

Posted - 03/07/2012 :  20:26:49  Show Profile  Reply with Quote
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 you
Anyways you can go with scheduler approach though it wont take place at real time.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000