Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger fire question

Status
Not open for further replies.

djj55

Programmer
Feb 6, 2006
1,761
US
Hello, SQL Server 2008R2
I have an insert trigger on a table. It seems to work for .NET applications but I did an insert with the SSIS Import/Export wizard and it did not seem to fire.
Code:
 CREATE TRIGGER trig_MyTable_Insert ON MyTable FOR INSERT AS 
SET NOCOUNT ON;
BEGIN 
    INSERT INTO My_TriggerLog (
        CreateDate, UserId, ServerName, ProcessName, Workstation, DatabaseName, TableName,
        FieldName, AgentID) 
    SELECT GETDATE(), SYSTEM_USER, @@ServerName, APP_NAME(), HOST_NAME(), 'MyDB', 
        'MyTable', 
        'Inserted record', 
        I.AgentID
    FROM inserted I 
END
Does SSIS not trigger? Is there a problem with my trigger?
Thanks



djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
djj55,

That is probably because you are using an OLE DB Destination Task, which uses bulk insert. See this link for more.

MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)
 
Thank you TheBugSlayer. That answered the question.

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
No problem.

MCP SQL Server 2000, MCTS SQL Server 2005, MCTS SQL Server 2008 (DBD, DBA)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top