Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a table in c# code which has 3 column fist first row column data will insert in database and it will generate a id and based on that id 2nd row data will insert and based on generated id by 2nd column 3rd row data will insert into database


value can be repated

like

like 3 table i ihave
kra goal criteria


kra1 goal1 criteria1
kra1 goal1 criteria2
kra2 goal2 criteria3
kra2 goal3 criteria4
like this

kra goal and criteria can be repeated
one kra can contail multiple goal and one goal can contain multiple criteria

What I have tried:

i am unable to do in sp ,while trying in c# it failing in different sceneria and that is not right to do in c# also what i feel
Posted
Updated 23-Jul-16 21:38pm

1 solution

Don't.
Instead, organise it as three tables:
kra is one table: the ID is an IDENTITY field.
Goals is a second table: it too has an IDENTITY ID field, and a foreign key to the ID in the kra table.
Criteria is the third: again, and IDENTITY ID field, and a foreign key to the ID in the Goals table.
Then when you want to retrieve the data, you use JOINs to build up your SELECT.
That way, you don't duplicate information unnecessarily.
It's then trivial to do the INSERTs in your SP.
 
Share this answer
 
Comments
Member 12650435 26-Jul-16 9:40am    
its already created i want to insert some data and i have excel sheet there i will read and insert into database .i am able to read and converted to data table the excel sheet then how to insert using sequence not happening.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900