Insert stored procedure
Posted on 2011-02-15
I have two tables.
First table has the ff. structure
tID tcode >>First table
Second table has
tID Name address>>Second table
What Id like to do is write an INSERT statement that would insert the value 38 in the tcode field of the First table under the following condition.
1. first if the 2 tables link based on the tID field.
2. If link exits, check in the first table if there is a value of 38 in the tCode. If not exist, INSERT 28 in the tCode otherwise,ingnore.
Essentliall the first table can have many codes under 1 tID like eg.
I included vb.net because, it may need a code to loop to each record in the table of the database.