Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Unanswered: Conditionally entering flat file data into relational Stucture


    I'm working on importing some data into my database. The data is currently in a SQL Server Table. I'm new to working with triggers (or performing more complex sql commands for that matter) but am trying to use a trigger on a view(that is identical to the table being imported) to handle a bulk insert.

    I was under the impression that the "inserted" table handles one record at a time. When I figured out that isn't the case, I felt stumped as to how to make importing decisions on each record.

    I have a Research Project Table consisting of ID,ProjectNum,Title
    Also, there is a ResearchProjectPeriod table consisting of ID,ProjectID,From,To,DirectCost,IndirectCost

    I'd like to check for projectNum on the records to import and if it exists in my database then only create associated entry in ResearchProjectPeriod table. If there is no associated ProjectNum then I would like to create the project as well as create an associated ResearchProjectPeriod Record.

    Thanks for your help.


  2. #2
    Join Date
    Feb 2002

    You could inport the data into a temp table and then go through the imported rows one by one or by batch.

    Hope it helps!
    - Jonte

Posting Permissions

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