Q
Q
Qairat2017-02-16 08:04:18
SQL Server
Qairat, 2017-02-16 08:04:18

Why doesn't the trigger work on Excel Import?

Can you please tell me if it is possible for the trigger to work when importing from Excel?
There is a trigger on after insert. It works if you add records manually, but for some reason it doesn't work when importing...
Here is my code:

alter trigger ForInsertEmpl on dbo.Employees
after insert
as
begin
    update e set EmpCenterId = 
    (select emp.Id from EmploymentCenter emp where emp.BIN = e.BIN) 
    from Employees e
    where e.Id in (select Id from inserted);
end

What can be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Skorzhinsky, 2017-02-16
@AndyKorg

If bcp is used for the import, here is the quote from msdn :
FIRE_TRIGGERS
Applied along with the in argument, it specifies that Insert triggers defined on the target table will run during the bulk copy operation. If the FIRE_TRIGGERS parameter is not specified, Insert triggers will not be executed. The FIRE_TRIGGERS option for the out, queryout, and format arguments is ignored.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question