|
mohan123
Posting Yak Master
India
196 Posts |
Posted - 01/03/2013 : 08:04:44
|
i have a table A
in which data look like this
userid documentid name 1 1 mohan
1 2 raj
1 3 majuu
2 1 raj
2 2 jey
2 3 lol
so we can observe user id 1 have 3 document id(1,2,3) so how to insert 4 and 5 records when userID 1 have 3 records if it have 3 rd record inserted simultaneously 4 and 5 th record should inserted through procedure can any one suggest me ???
P.V.P.MOhan |
|
|
nigelrivett
Flowing Fount of Yak Knowledge
United Kingdom
3328 Posts |
Posted - 01/03/2013 : 08:27:43
|
How are the rows inserted? Do you mean if there is an insert for a user id that has 2 roes then you want an extra two added?
Obvious options are Insert via a stored procedure, count the rows then insert the extra 2 if there are 3 rows. It will need to be in a transaction. Create a trigger for insert. If the count is 3 for the user then add the extra 2 rows.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|