Hi,
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.
Stephen
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.
Stephen