none
insert trigger throws error on Windows Server 2008 but not on Windows 7 RRS feed

  • Question

  • We are experiencing a problem running our web app on our Windows Server 2008 test machine.  The problem lies in an insert trigger on one of the tables being modified by a LINQ query in our code.  When running on our test server, we see an exception that states:

    “The target table 'dbo.Studies' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.”

    Turning on the DataContext log on my local machine running Windows 7 I see this, which obviously has an INTO clause:

     

    DECLARE @output TABLE([StudyId] UniqueIdentifier)
    INSERT INTO [dbo].[Studies]([PatientId], [StartDate], [DurationDays], [ModifiedByUserId], [TaskGroupId], [Hand], [SetupWizardStepReached], [Interpretation], [InterpretationAuthor], [Recommendation], [StatusCode], [LastModified], [Approved], [InstitutionId], [CreatedByUser], [DateCreated], [LastModifiedBy], [DateLastModified])
    OUTPUT INSERTED.[StudyId] <strong>INTO @output</strong>
    VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15, @p16, @p17)
    SELECT [StudyId] FROM @output
    -- @p0: (parameter data removed for brevity)
    -- Context: SqlProvider(Sql2008) Model: AttributedMetaModel Build: 3.5.30729.4926
    
    

     

    Running the same code on our Windows Server 2008 box produces the following log:

     

    DECLARE @output TABLE([StudyId] UniqueIdentifier)
    INSERT INTO [dbo].[Studies]([PatientId], [StartDate], [DurationDays], [ModifiedByUserId], [TaskGroupId], [Hand], [SetupWizardStepReached], [Interpretation], [InterpretationAuthor], [Recommendation], [StatusCode], [LastModified], [Approved], [InstitutionId], [CreatedByUser], [DateCreated], [LastModifiedBy], [DateLastModified])
    OUTPUT INSERTED.[StudyId]
    VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15, @p16, @p17)
    SELECT [StudyId] FROM @output
    -- @p0: (parameter data removed for brevity)
    -- Context: SqlProvider(Sql2008) Model: AttributedMetaModel Build: 3.5.30729.1
    
    This log is missing the INTO @output clause that the locally-running application created.  I see that the version number referenced is different, as well.  My problem is that I seem to have installed every applicable .Net Framework update and hotfix, but this problem remains.  How can I get my server to use the same version 3.5.30729.4926 that my local machine is using? Is this a bug that MS is aware of?

    Monday, September 27, 2010 11:07 PM

Answers

  • Found the hotfix for this issue: http://support.microsoft.com/kb/961073
    • Marked as answer by gferreri Tuesday, September 28, 2010 1:28 PM
    Tuesday, September 28, 2010 1:28 PM