Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    UK
    Posts
    122

    Arrow Unanswered: 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/showthread.php?threadid=988682

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    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

  3. #3
    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

  4. #4
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •