SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2004
    Location
    Singapore
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Any Ideas or guides?

    Hi All

    I have 3 tables to create and have to insert initial 10 records for each tables. So e.g
    Table1: ID(PK) Name Address Salary
    Table2: PARTID(PK) Category Status ID(FK from table1)
    Table3: DeptID(PK) PIC PARTID(FK) LOC

    So is there any way to insert records into all 3 tables once? Now when i insert records individually I can not insert for Foreign key field they said Parent key can not be found.

    I have successfully can insert 10 records in Table1.But got error when i insert into Table 2 (some same records ID) and Table 3.
    Please help..

    Thnks,

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,270
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    define your tables without foreign keys

    load your rows

    ALTER the table to add the foreign key definitions and cross your fingers that the data was okay
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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