question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause

See original GitHub issue

Issue type:

[ ] question [x] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [x] mssql [ ] mysql / mariadb [ ] oracle [ ] postgres [ ] cockroachdb [ ] sqlite [ ] sqljs [ ] react-native [ ] expo

TypeORM version:

[x] latest [ ] @next [ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

I have tried to insert Person into MSSQL table which contains one trigger, and I have run into this exception:

The target table \'Person.person\' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.

Typeorm tried to execute this query:

exec sp_executesql @statement=N'INSERT INTO "Person"."person"("FirstName", "LastName", "Title") OUTPUT INSERTED."BusinessEntityID" VALUES (@0, @1, @2)',@params=N'@0 nvarchar(50), @1 nvarchar(50), @2 nvarchar(8)',@0=N'Alija',@1=N'Bobija',@2=N'Mr.'

I have used database AdventureWorks2017 that is open source and available on Microsoft online websites.

This is my Person entity:

@Entity({
    schema: 'Person'
})
export default class Person extends BaseEntity {
    @PrimaryGeneratedColumn({
        name: 'BusinessEntityID'
    })
    Id!: number;

    @Column({
        length: 50
    })
    FirstName! : string;

    @Column({
        length: 50
    })
    LastName!: string;

    @Column({
        length: 8
    })
    Title!: string;
}

And this is my code for adding new person:

    await Person.insert({
        FirstName: 'Alija',
        LastName: 'Bobija',
        Title: 'Mr.'
    });

Best regards

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
abobijacommented, Jan 25, 2020

Hi, sorry for late response. @sgarner thank you very very much for this contribution! Now I can finally continue with my project, woohoo! 👍

1reaction
sgarnercommented, Jan 15, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot use UPDATE with OUTPUT clause when a trigger is ...
Given the kludge needed to make UPDATE with OUTPUT work in SQL ... triggers if the statement contains an OUTPUT clause without INTO...
Read more >
The target table of the DML statement cannot have ... - GitHub
The target table of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause. #4535....
Read more >
SQL Server Error Messages - Msg 334
... The target table '<Table Name>' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without...
Read more >
DML statement cannot have any enabled triggers if the ...
DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause. Cause: With version 9.5.6.0 a new ......
Read more >
Error when submitting "new" form to SQL
of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found