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 |
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2006-10-06 : 03:36:41
|
| hi,here i had created two table named table1,table. both the tables are homogenously belongs to same group. if i eneter any data say pinno in table1 the same pinno has to be enterd into table so i had wirtten a trigger for table here like this:create trigger Tg_Table1 on Table1for insert asinsert into Table2(pinno) select pinno as pinno from table1.the query is getting compiling correctly but the data entered into table2 while entering into the table1 is coming with duplicate values like:output of table2:pinno1001 -> when i inserted 1001 in table11001 -> when i inserted 1002 in table110021001 -> when i inserted 1003 in table110021003the column name pinno in table1 is also same for table2.intially i had primary keys for two tables for column pinno. at that time it has shown error wqhile i am trying to insert data into table1.so i dropped the PK constarint for table2. this time the out put coming with replicated values.pls some one show me a way to clear this problemOne can never consent to creep,when one feels an impulse to soarRAMMOHAN |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-10-06 : 03:38:19
|
| [code]create trigger Tg_Table1 on Table1for insert asinsert into Table2(pinno)select pinno as pinno from inserted[/code]but that's probably not the whole answer to your problems, so suggest you read up in Books Online aboter Triggers.Kristen |
 |
|
|
|
|
|