Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How will i insert data in the table , where data that i'am inserting it will be inserted in the other table in the system which are recording the same data .
Posted
Comments
[no name] 26-Sep-15 12:38pm    
Please describe it more with your table names.
Secondly "Connected Together" what it is stands for, please clarify.
Member 12013429 26-Sep-15 12:53pm    
you have to tables

CREATE TABlE Person
( person_id int PRIMARY KEY,
FirstName varchar(12) NOT NULL,
LastName varchar(12),
Age int ,
Gender varchar(12)
)

CREATE TABLE Address
( address_id int PRIMARY KEY,
address_name varchar(20),
person_id int FOREIGN KEY REFFERENCE Person(person_id)
)

Now i want when i'am filling the table Person , the person_id that i have entered in table Person, it will enter it self in table Address where column is person_id

Automatically? There's no such thing.

You have to insert your data into the Person table, get back the ID it was assigned, then use that in a second Insert into the Address table with the remaining data.
 
Share this answer
 
as Dave say's there is nothing like Automatically
you can use stored procedure to perform your task and to maintain ACID property you can use transaction in stored procedure
 
Share this answer
 

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