If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Two tables update at the same time.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-16-04, 15:52
Matt_T_hat Matt_T_hat is offline
Registered User
 
Join Date: Sep 2003
Location: UK
Posts: 122
Arrow Two tables update at the same time.

I have two tables in a very large database. Entity and Address. For reasons of simplicity it is safe to assume that most entities have just one address.

This portion of the DB reseaves data maked as untested from a web page.

The page runs ASP with VBscript.

What I would like to do is create a single form receave the data from that form and then build the SQL at run time to add the data to the database. I've done this before but this time I wish to add the data to both tables at the same time to avoid neadlessly messing about with seasion cookies and the like while I get the system to remember the ID number of the first table.

The problem is I am unsure how to construct my SQL in order to do this.

The tables are related [ENTITY]--<[Address] useing Integer Keys.

I will also need to submit the value null to at least three fields that default to 0.
__________________
Matt the Hat says: "what!?"
A child of five could understand this! Fetch me a child of five!
SCARY HARD CHALLENGE: http://www.dbforums.com/database-concepts-design/988682-better-relational-design.html
Reply With Quote
  #2 (permalink)  
Old 09-17-04, 13:09
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,455
Cool

Create a stored procedure which when executed will take the data and insert into both tables.

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #3 (permalink)  
Old 09-21-04, 11:35
Matt_T_hat Matt_T_hat is offline
Registered User
 
Join Date: Sep 2003
Location: UK
Posts: 122
"I can't do that dave"

I'm useing pure SQL to do this from VBscript and to a MS Access 2000 DB. Stored Procs is a platform specific thing that 2K don't got.

Any other idea?
__________________
Matt the Hat says: "what!?"
A child of five could understand this! Fetch me a child of five!
SCARY HARD CHALLENGE: http://www.dbforums.com/showthread.php?threadid=988682
Reply With Quote
  #4 (permalink)  
Old 09-21-04, 12:18
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,455
Talking

Quote:
Originally Posted by Matt_T_hat
I'm useing pure SQL to do this from VBscript and to a MS Access 2000 DB. Stored Procs is a platform specific thing that 2K don't got.

Any other idea?
If NO stored procedure, then NO single SQL statement.

You will need TWO statements, one for each table you wish to insert into.

Maybe It's time you change from MS Access to a REAL database.

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On