I have an after Insert trigger which is working fine when I am inserting a single record in a table.
ALTER TRIGGER [dbo].[Insert_Into_Questions_Table]
ON [dbo].[Questionmaster]
After Insert
AS
BEGIN
Insert into Questions(Question_questionid,Question_questionname,Question_answer1,Question_answer2,Question_answer3,Question_answer4,Exam_examtypeid,User_Userid)
select Question_questionid,Question_questionname,Question_answer1,Question_answer2,Question_answer3,Question_answer4,Exam_examtypeid,User_Userid from Inserted
SET NOCOUNT ON;
-- Insert statements for trigger here
END
Problem:
When I am trying to Insert Multiple Records using BulkCopy from my C# code trigger is not working.
By default, the BULK INSERT statement do not execute triggers. However, you can enable triggers by using FIRE_TRIGGERS qualifiers:
http://msdn.microsoft.com/en-us/library/ms188365(v=sql.105).aspx
SQL Server 2005 and later versions use row versioning for triggers and stores the row versions in the version store in tempdb. Before you can bulk import a large batch of data records using triggers, you may need to expand the size of tempdb to accommodate the impact of the triggers on the version store. For more information
http://msdn.microsoft.com/en-us/library/ms175492(v=sql.105).aspx