| Author |
Topic |
|
hueby
Posting Yak Master
127 Posts |
Posted - 2006-03-23 : 18:29:03
|
| Hi all,I'll try to explain this the best I can. Hopefully the way I'm attempting to do this makes some sense, and is in the right direction.I will have one row of data including these columns, for example, item_code, vendor, sortnumber. They are all primary keys.From this row, I need to create 3 extra rows with variation in the sortnumber. For example, I start off with:item_code, vendor, sortnumberBLAH, ABC, 1Then, I need to get this from some code, etc.item_code, vendor, sortnumberBLAH, ABC, 1BLAH, ABC, 2BLAH, ABC, 3BLAH, ABC, 4So... can I get some suggestions, help, etc?? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-03-23 : 18:49:20
|
if you are doing the insert via stored procedure, you can perform the 3 additional rows of insert there.You can also use insert trigger to do this KHChoice is an illusion, created between those with power, and those without.Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-03-24 : 05:06:09
|
| Also, why do you want to do this?MadhivananFailing to plan is Planning to fail |
 |
|
|
hueby
Posting Yak Master
127 Posts |
Posted - 2006-03-24 : 09:25:49
|
| Hi all,Thanks for the info. I did not realize I could do multiple inserts in a SP like this. Cool...I have to do this, because of our current accounting system. I'm doing some custom data dumping, and their database requires some weird things...... |
 |
|
|
hueby
Posting Yak Master
127 Posts |
Posted - 2006-04-07 : 10:34:48
|
Okay, so I know what I want to do now.. but how do I get in a "multiple insert"? INSERT into test1..IM_super_xref_mc(company_code, sort_type, key_1, key_2, key_3, item_code)select company_code, '1', item_category, vendor_code_list1, vendor_part_number, item_code from test1..im_item_master_mcINSERT into test1..IM_super_xref_mc(company_code, sort_type, key_1, key_2, key_3, item_code)select company_code, '2', ' ', vendor_code_list1, vendor_part_number, item_code from test1..im_item_master_mcINSERT into test1..IM_super_xref_mc(company_code, sort_type, key_1, key_2, key_3, item_code)select company_code, '3', ' ', ' ', vendor_part_number, item_code from test1..im_item_master_mcINSERT into test1..IM_super_xref_mc(company_code, sort_type, key_1, key_2, key_3, item_code)select company_code, '4', ' ', ' ', ' ', item_code from test1..im_item_master_mc |
 |
|
|
hueby
Posting Yak Master
127 Posts |
Posted - 2006-04-07 : 11:14:51
|
Disregard this.. I found a solution.INSERT into test1..IM_super_xref_mc(company_code, sort_type, key_1, key_2, key_3, item_code)select company_code, '1', item_category, vendor_code_list1, vendor_part_number, item_codefrom test1..im_item_master_mcunion allselect company_code, '2', ' ', vendor_code_list1, vendor_part_number, item_codefrom test1..im_item_master_mcunion allselect company_code, '3', ' ', ' ', vendor_part_number, item_codefrom test1..im_item_master_mcunion allselect company_code, '4', ' ', ' ', ' ', item_codefrom test1..im_item_master_mc |
 |
|
|
|
|
|