Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
norty911
Starting Member
41 Posts |
Posted - 2007-06-18 : 06:39:05
|
| Hey guys up until now i've only inserted data into a single table. Now I have a form that collects information over a span of three forms. Each form has a table related to it and these three tables are related to each other. What I want to know is: 1)How do you go abouts inserting data into multiple related tables that have constraints on them?2)Would you use a stored procedure in an instance like this?3)At what stage would you execute the sql queries. I assume you do this once you have collected all the required information as opposed to: Enter info into form1, submit form1 data to database... enter info into form2, submit form2 data into database etcAny help would be greatly appreciated!Say for instance I have three related tables. table1------tbl1_idtbl1_data1tbl1_data2table2------tbl2_idtbl2_data1tbl2_data2table3------tbl3_idtbl3_data1tbl3_data2table1 has a one-to-many relationship with table2table3 has a one-to-one relationship with table2 |
|
|
norty911
Starting Member
41 Posts |
Posted - 2007-06-18 : 10:46:45
|
| Could someone pls help me with this as it is urgent! |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-18 : 11:33:46
|
| Insert data into Table2 first. Record the tbl2_id.Now insert in table Table1 and Table3.Peter LarssonHelsingborg, Sweden |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-06-18 : 11:35:04
|
| you first insert data into parent tables then into child tables.db data entry is usually done at the end page. you can cache the data until then._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
|
|
|