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 |
TajKazi
Posting Yak Master
101 Posts |
Posted - 2014-11-06 : 02:07:07
|
can we use tables variables in triggersif yes please post an example |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-11-06 : 10:04:07
|
surecreate trigger foo on mytable for insert asdeclare @t table (a int) however, you didn't say what you wanted to do with the table variable |
|
|
TajKazi
Posting Yak Master
101 Posts |
Posted - 2014-11-07 : 00:30:56
|
please give me one sample insert trigger example for getting me good idea about that conceptn thanks for reply n considering me............. |
|
|
TajKazi
Posting Yak Master
101 Posts |
Posted - 2014-11-07 : 00:47:35
|
also i have some doubts please clear me ..1] consider in after insert trigger if i am inserting some data in other table than trigger table, within that trigger. when i going to insert some some data in table having trigger at that time ... first data inserted in that other table and then table having trigger is it right or is that happening in any other way2] also in instead of insert trigger if i don't write insert statement for table having trigger on it. then at the time of inserting data in that particular table having trigger. is data is gets inserted in that table having trigger or not .... cause i didn't write insert statement for that particular statement........... is it right or not pleas clarify my doubts cause i am a just beginner so help me |
|
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-11-07 : 09:57:28
|
1. for after insert, just like the name says. it happens after the insert into the primary table2. for instead of, just like the name says, it happens instead of inserting into the primary tablebe sure you read the docs and examples on triggers:http://msdn.microsoft.com/en-us/library/ms189799.aspx |
|
|
|
|
|