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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 row level trigger in sql 2005

Author  Topic 

sharmila
Starting Member

4 Posts

Posted - 2006-07-19 : 07:54:46
Posted - 07/19/2006 : 07:49:56
--------------------------------------------------------------------------------

hi
actually i have a temporay table wich has four columns
say col_1,col_2,col_3,col_4.
so firstly i wud bulk insert from a text file wich mite contain thousands of rows.
then from this temp table col_1 and col_2 shd go to master_a.wich has an identiy column as primary key.
say id,col_1, col_2.

i will have another table detail_b where in there is a foreign key to the table master_a for id.
so it will have f_id, col_3,col_4.

so i am riting a trigger on master_a. so whenver row is inserted in master_a. coresponding id and col 3 col4 shd be inserted into detail_b.

For this in oracle we have row level trigger. where in for each insertion in master a .. correspoding trigger will fire but in sql 2000..
but i wud like to implemtn row level trigger..
can u hlep me out..

druer
Constraint Violating Yak Guru

314 Posts

Posted - 2006-07-19 : 15:37:54
In SQL Server you can look up ficticious tables INSERTED, DELETED in books on line to see how to access the data inside of a trigger.

However, If Table1 only has Columns 1 and 2 in it, I'm not sure how you'll have values for Columns 3 and 4. From your explanation it sounds like perhaps you should use an insertion stored procedure that takes Columns 3 and 4, does the insert to table 1, and gets the identity value, then inserts a record to table 2 with that value, and the values for columns 3 and 4.


Hope it helps,
Dalton

Blessings aren't so much a matter of "if they come" but "are you noticing them."
Go to Top of Page
   

- Advertisement -